<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="utf-8">
  
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <link rel="dns-prefetch" href="http://yoursite.com">
  <title>张旭辉的个人博客</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="title: Java基础复习date: 2019-08-27 17:07:18tags: 一时学习一时爽、一直学习一直爽、代码虐我千百遍、我视代码如初恋。 Java基础复习">
<meta property="og:type" content="article">
<meta property="og:title" content="张旭辉的个人博客">
<meta property="og:url" content="http://yoursite.com/2019/08/27/Java基础复习/index.html">
<meta property="og:site_name" content="张旭辉的个人博客">
<meta property="og:description" content="title: Java基础复习date: 2019-08-27 17:07:18tags: 一时学习一时爽、一直学习一直爽、代码虐我千百遍、我视代码如初恋。 Java基础复习">
<meta property="og:locale" content="en">
<meta property="og:updated_time" content="2019-11-21T08:05:36.721Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="张旭辉的个人博客">
<meta name="twitter:description" content="title: Java基础复习date: 2019-08-27 17:07:18tags: 一时学习一时爽、一直学习一直爽、代码虐我千百遍、我视代码如初恋。 Java基础复习">
  
    <link rel="alternative" href="/atom.xml" title="张旭辉的个人博客" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  <link rel="stylesheet" type="text/css" href="/./main.0cf68a.css">
  <style type="text/css">
  
    #container.show {
      background: linear-gradient(200deg,#ccc,#000);
    }
  </style>
  

  

</head>
</html>
<body>
  <div id="container" q-class="show:isCtnShow">
    <canvas id="anm-canvas" class="anm-canvas"></canvas>
    <div class="left-col" q-class="show:isShow">
      
<div class="overlay" style="background: #4d4d4d"></div>
<div class="intrude-less">
	<header id="header" class="inner">
		<a href="/" class="profilepic">
			<img src="" class="js-avatar">
		</a>
		<hgroup>
		  <h1 class="header-author"><a href="/">zhangxuhui</a></h1>
		</hgroup>
		

		<nav class="header-menu">
			<ul>
			
				<li><a href="/">主页</a></li>
	        
				<li><a href="/tags/随笔/">随笔</a></li>
	        
			</ul>
		</nav>
		<nav class="header-smart-menu">
    		
    			
    			<a q-on="click: openSlider(e, 'innerArchive')" href="javascript:void(0)">所有文章</a>
    			
            
    			
    			<a q-on="click: openSlider(e, 'friends')" href="javascript:void(0)">友链</a>
    			
            
    			
    			<a q-on="click: openSlider(e, 'aboutme')" href="javascript:void(0)">关于我</a>
    			
            
		</nav>
		<nav class="header-nav">
			<div class="social">
				
					<a class="github" target="_blank" href="#" title="github"><i class="icon-github"></i></a>
		        
					<a class="weibo" target="_blank" href="#" title="weibo"><i class="icon-weibo"></i></a>
		        
					<a class="rss" target="_blank" href="#" title="rss"><i class="icon-rss"></i></a>
		        
					<a class="zhihu" target="_blank" href="#" title="zhihu"><i class="icon-zhihu"></i></a>
		        
			</div>
		</nav>
	</header>		
</div>

    </div>
    <div class="mid-col" q-class="show:isShow,hide:isShow|isFalse">
      
<nav id="mobile-nav">
  	<div class="overlay js-overlay" style="background: #4d4d4d"></div>
	<div class="btnctn js-mobile-btnctn">
  		<div class="slider-trigger list" q-on="click: openSlider(e)"><i class="icon icon-sort"></i></div>
	</div>
	<div class="intrude-less">
		<header id="header" class="inner">
			<div class="profilepic">
				<img src="" class="js-avatar">
			</div>
			<hgroup>
			  <h1 class="header-author js-header-author">zhangxuhui</h1>
			</hgroup>
			
			
			
				
			
				
			
			
			
			<nav class="header-nav">
				<div class="social">
					
						<a class="github" target="_blank" href="#" title="github"><i class="icon-github"></i></a>
			        
						<a class="weibo" target="_blank" href="#" title="weibo"><i class="icon-weibo"></i></a>
			        
						<a class="rss" target="_blank" href="#" title="rss"><i class="icon-rss"></i></a>
			        
						<a class="zhihu" target="_blank" href="#" title="zhihu"><i class="icon-zhihu"></i></a>
			        
				</div>
			</nav>

			<nav class="header-menu js-header-menu">
				<ul style="width: 50%">
				
				
					<li style="width: 50%"><a href="/">主页</a></li>
		        
					<li style="width: 50%"><a href="/tags/随笔/">随笔</a></li>
		        
				</ul>
			</nav>
		</header>				
	</div>
	<div class="mobile-mask" style="display:none" q-show="isShow"></div>
</nav>

      <div id="wrapper" class="body-wrap">
        <div class="menu-l">
          <div class="canvas-wrap">
            <canvas data-colors="#eaeaea" data-sectionHeight="100" data-contentId="js-content" id="myCanvas1" class="anm-canvas"></canvas>
          </div>
          <div id="js-content" class="content-ll">
            <article id="post-Java基础复习" class="article article-type-post " itemscope itemprop="blogPost">
  <div class="article-inner">
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>title: Java基础复习<br>date: 2019-08-27 17:07:18<br>tags: 一时学习一时爽、一直学习一直爽、代码虐我千百遍、我视代码如初恋。</p>
<h1 id="Java基础复习"><a href="#Java基础复习" class="headerlink" title="Java基础复习"></a>Java基础复习</h1><a id="more"></a>

<h2 id="一、绪论（2019-08-27）"><a href="#一、绪论（2019-08-27）" class="headerlink" title="一、绪论（2019.08.27）"></a>一、绪论（2019.08.27）</h2><h3 id="１、计算机包括硬件和软件两个部分。"><a href="#１、计算机包括硬件和软件两个部分。" class="headerlink" title="１、计算机包括硬件和软件两个部分。"></a>１、计算机包括硬件和软件两个部分。</h3><p>硬件就是看得见的部分例如鼠标、键盘、主机、显示器。软件就是看不见的指令，例如操作系统、应用软件。</p>
<h3 id="2、世界上没有最好的语言，每种语言都有各自的优点和缺点。（其实Java是世界上最好的语言）。"><a href="#2、世界上没有最好的语言，每种语言都有各自的优点和缺点。（其实Java是世界上最好的语言）。" class="headerlink" title="2、世界上没有最好的语言，每种语言都有各自的优点和缺点。（其实Java是世界上最好的语言）。"></a>2、世界上没有最好的语言，每种语言都有各自的优点和缺点。（其实Java是世界上最好的语言）。</h3><h3 id="3、冯诺依曼体系结构"><a href="#3、冯诺依曼体系结构" class="headerlink" title="3、冯诺依曼体系结构"></a>3、冯诺依曼体系结构</h3><p>现代计算机的基础，现代大多数计算机仍然是冯诺依曼体系的组织结构，只是做了部分改进，并没有从根本上挣脱此体系的束缚。我们称冯诺依曼为计算机之父。中央处理器cpu以频率为衡量标准：1024hz = 1khz,1024khz=1mhz,1024mhz=1ghz（兆赫兹）。</p>
<h3 id="4、IT行业三大定律"><a href="#4、IT行业三大定律" class="headerlink" title="4、IT行业三大定律 :"></a>4、IT行业三大定律 :</h3><p>1、摩尔定律:  同价格的硬件每隔18-24个月，性能会翻一倍。2、安迪比尔定律 ：软件和硬件同时提升，才能带来更好的体验。3、反摩尔定律：如果一个IT公司今天和18个月卖掉同样多的产品，那么它的营业额就降低一半。</p>
<h3 id="5、存储设备"><a href="#5、存储设备" class="headerlink" title="5、存储设备"></a>5、存储设备</h3><p>硬盘: 机械硬盘、固态硬盘，本地存储。内存：内存条，断电数据丢失。8比特bit = 1字节byte,1024b =1k。一个0或者一个1存储为一个bit ，是计算机的最小存储单位。字节是计算中最基本的存储单元。1024程序员节。内存的存取速度是硬盘的十倍，计算机操作数据必须先加载到内存中、或者保存数据先经过内存再到硬盘。</p>
<h3 id="６、操作系统是运行在计算机上的最重要的程序，它可以管理和控制计算机的活动。"><a href="#６、操作系统是运行在计算机上的最重要的程序，它可以管理和控制计算机的活动。" class="headerlink" title="６、操作系统是运行在计算机上的最重要的程序，它可以管理和控制计算机的活动。"></a>６、操作系统是运行在计算机上的最重要的程序，它可以管理和控制计算机的活动。</h3><h3 id="７、万维网world-wide-web"><a href="#７、万维网world-wide-web" class="headerlink" title="７、万维网world wide web"></a>７、万维网world wide web</h3><p>web客户端浏览器可以通过url统一资源定位符，去访问web服务端上的资源。这些资源通过超文本传输协议http传输给用户。</p>
<h3 id="8、java语言应用场景："><a href="#8、java语言应用场景：" class="headerlink" title="8、java语言应用场景："></a>8、java语言应用场景：</h3><p>Java基础是JavaEE，大数据、android开发的基石。</p>
<h2 id="二、Java语言概述（2019-08-28）"><a href="#二、Java语言概述（2019-08-28）" class="headerlink" title="二、Java语言概述（2019.08.28）"></a>二、Java语言概述（2019.08.28）</h2><h3 id="1、人机交互方式"><a href="#1、人机交互方式" class="headerlink" title="1、人机交互方式"></a>1、人机交互方式</h3><p>图形化界面GUI： 简单直观、便于操作、易于接受。命令行方式CLI：输入特定的指令完成操作，需要记住一些命令。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">win+r 输入cmd 打开命令提示窗口</span><br><span class="line">dir 列出当前目录下的所有文件及文件夹</span><br><span class="line">md 创建目录（文件夹）</span><br><span class="line">rd 删除目录</span><br><span class="line">cd 进入指定目录</span><br><span class="line">cd.. 返回上级目录</span><br><span class="line">cd/ 返回根目录</span><br><span class="line">del 删除文件</span><br><span class="line">exit 退出</span><br><span class="line">echo javase&gt;<span class="number">1</span>.doc 将指定的数据写入新建的文件中</span><br></pre></td></tr></table></figure>

<h3 id="2、Java语言的分类"><a href="#2、Java语言的分类" class="headerlink" title="2、Java语言的分类"></a>2、Java语言的分类</h3><h3 id="JavaSE标准版、JavaEE企业版、JavaME移动版"><a href="#JavaSE标准版、JavaEE企业版、JavaME移动版" class="headerlink" title="JavaSE标准版、JavaEE企业版、JavaME移动版"></a>JavaSE标准版、JavaEE企业版、JavaME移动版</h3><h3 id="3、Java语言的特点"><a href="#3、Java语言的特点" class="headerlink" title="3、Java语言的特点"></a>3、Java语言的特点</h3><p>面对对象、安全、开源、跨平台、解释型、健壮性、多线程、去掉指针、自动的垃圾回收机制。</p>
<h3 id="4、JVM"><a href="#4、JVM" class="headerlink" title="4、JVM"></a>4、JVM</h3><p>不同操作系统有不同的jvm，一次编译处处运行，。垃圾回收机制：自动的垃圾回收机制，但还是会出现内存溢出（内存空间已不足供继续使用）、内存泄漏（没有任何的引用的对象没有被回收），内存泄漏最终会导致内存溢出。</p>
<h3 id="5、JDK"><a href="#5、JDK" class="headerlink" title="5、JDK"></a>5、JDK</h3><p>java开发工具包，包含：JRE+java开发工具集，JRE又包含：jvm+java类库。</p>
<h3 id="6、JDK的安装目录"><a href="#6、JDK的安装目录" class="headerlink" title="6、JDK的安装目录"></a>6、JDK的安装目录</h3><p>不应该有中文，不要使用默认的路径，最好安装在SSD固态硬盘，提高运行速度。JRE运行环境可以不安装，但是建议安装，因为使用esclipse要加载独立的jre。安装目录：bin目录java工具，lib目录jar包。</p>
<h3 id="7、环境变量的配置path"><a href="#7、环境变量的配置path" class="headerlink" title="7、环境变量的配置path"></a>7、环境变量的配置path</h3><p>提供windows命令行中指令的可执行文件路径，当我们在命令行中键入指令时，根据环境变量中的path值，找到对应的指令可执行文件进行执行，是提供给计算机系统的。classpath:jdk1.6之后不用配置也不建议配置，如果配置也要配置正确，其作用是告诉jvm系统中class文件的路径。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">JAVA_HOME D:\SystemForJava\java_1.8</span><br><span class="line">Path %JAVA_HOME%\bin</span><br></pre></td></tr></table></figure>

<h3 id="8、第一个Java程序"><a href="#8、第一个Java程序" class="headerlink" title="8、第一个Java程序"></a>8、第一个Java程序</h3><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study01;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-08-29 14:26</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">HelloWorld</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String [] args)</span></span>&#123;</span><br><span class="line">        System.out.println(<span class="string">"Hello World"</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="9、Java中的注释"><a href="#9、Java中的注释" class="headerlink" title="9、Java中的注释"></a>9、Java中的注释</h3><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study01;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 单行、多行注释不参与编译，生成的class文件中不包含注释信息，</span></span><br><span class="line"><span class="comment"> * 对程序解释说明，增强可读性。可以简单的调试程序。</span></span><br><span class="line"><span class="comment"> * 文档注释：注释内容可以被JDK提供的工具javadoc所解析，形成一套以网页文件形式体现的该程序的说明文件</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-08-29 14:26</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">HelloWorld</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String [] args)</span></span>&#123;</span><br><span class="line">        System.out.println(<span class="string">"Hello World"</span>);</span><br><span class="line">       <span class="comment">/*</span></span><br><span class="line"><span class="comment">        System.out.println("Hello World");输出换行</span></span><br><span class="line"><span class="comment">        System.out.print("Hello World");输出不换行</span></span><br><span class="line"><span class="comment">        System.out.println("Hello World");多行注释：注释多行，不可以嵌套使用</span></span><br><span class="line"><span class="comment">        */</span></span><br><span class="line">        <span class="comment">//System.out.println("Hello World");单行注释：注释一行</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="10、API"><a href="#10、API" class="headerlink" title="10、API"></a>10、API</h3><p>Java提供的基本编程接口，API文档即API的使用说明书。一个java源文件可以声明多个class，但是只能有一个类是被public修饰的，且只能加在和文件名同名的类上。即public修饰的类名和文件名相同。程序的入口是main方法，格式固定。每一个语句都以；结尾。每一个语句单独占一行。</p>
<h2 id="三、Java基础"><a href="#三、Java基础" class="headerlink" title="三、Java基础"></a>三、Java基础</h2><h3 id="1、关键字与保留字"><a href="#1、关键字与保留字" class="headerlink" title="1、关键字与保留字"></a>1、关键字与保留字</h3><p>关键字：被java语言赋予了特殊含义，用作专门用途的单词，关键字中的所有单词都小写。calss public 等..</p>
<p>保留字：现有的java版本没有使用，以后的版本有可能使用。goto，const</p>
<h3 id="2、标识符"><a href="#2、标识符" class="headerlink" title="2、标识符"></a>2、标识符</h3><p>定义：变量、方法和类等要素命名时使用的字符序列。凡是可以自己定义名字的地方都叫标识符。</p>
<p>定义规则：1.由26个英文大小写字母、数字0-9，_ 或$组成。2.数字不可以开头 3.不可以使用关键字和保留字但能包含。4.严格区分大小写，长度无限制。5.不能包含空格。驼峰原则，见名知意。</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">java中命名规范：</span><br><span class="line">    包名：xxx 全部小写</span><br><span class="line">    类名、接口名：XxxYyy</span><br><span class="line">    方法名：xxYyy</span><br><span class="line">    变量名：xxxYyyy</span><br><span class="line">    常量名：XXX_YYY</span><br></pre></td></tr></table></figure>

<h3 id="3、变量"><a href="#3、变量" class="headerlink" title="3、变量"></a>3、变量</h3><h4 id="1、概念："><a href="#1、概念：" class="headerlink" title="1、概念："></a>1、概念：</h4><p>内存中的一块存储区域，该区域中的数据可以在同一范围内不断变化，变量是程序中最基本的存储单元，包含变量类型，变量名和变量值。</p>
<h4 id="2、使用："><a href="#2、使用：" class="headerlink" title="2、使用："></a>2、使用：</h4><p>每个变量必须先声明后使用，通过变量名来访问保存的数据，变量的作用域在一对{}内才有效，同一作用域内不能定义同名的变量。</p>
<h4 id="3、基本数据类型的分类-8种"><a href="#3、基本数据类型的分类-8种" class="headerlink" title="3、基本数据类型的分类(8种)"></a>3、基本数据类型的分类(8种)</h4><p>整数型：byte short int long    /1字节（-128-127）2字节 4字节 8字节    / 1byte=8bit  /  默认为int型的，声明long型变量末尾加”L”, long num = 123132132L;日常使用为int类型的变量已足够使用。</p>
<p>浮点型（带小数的数值）：float单精度 double双精度 / 4字节 8字节 / float表示数值的范围比long还大 / 默认为double类型的，声明float类型的要在末尾加”f”或者”F”。日常使用为double类型的变量已足够使用。</p>
<p>字符型：char 1字符 = 2字节，char str = ‘a’ ；单引号包围且只能写一个字符，转义字符：\t制表符 \n换行符，使用unicode，char str = ‘\u0043’</p>
<p>布尔型：boolean   true false,在条件判断和循环结构中使用</p>
<p>引用数据类型：类、接口、数组、枚举</p>
<p>按位置分类：成员变量 局部变量</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study01;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 变量</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-08-29 16:12</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">variate</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="comment">//先声明后使用</span></span><br><span class="line">        <span class="keyword">int</span> age = <span class="number">18</span> ;</span><br><span class="line">        <span class="keyword">double</span> num = <span class="number">1.0</span>;</span><br><span class="line">        <span class="keyword">long</span> s = <span class="number">11115555555L</span>;</span><br><span class="line">        <span class="keyword">char</span> sts = <span class="string">'\u0043'</span>;</span><br><span class="line">        <span class="keyword">char</span> str = <span class="string">'a'</span>；</span><br><span class="line">        System.out.println(sts);</span><br><span class="line">        System.out.println(str);</span><br><span class="line">        System.out.println(s);</span><br><span class="line">        System.out.println(age);</span><br><span class="line">        System.out.println(num);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="4、字符集"><a href="#4、字符集" class="headerlink" title="4、字符集"></a>4、字符集</h3><p>​    字符编码（英语：Character encoding）也称字集码，是把<a href="https://baike.baidu.com/item/字符集" target="_blank" rel="noopener">字符集</a>中的<a href="https://baike.baidu.com/item/字符/4768913" target="_blank" rel="noopener">字符</a><a href="https://baike.baidu.com/item/编码" target="_blank" rel="noopener">编码</a>为指定<a href="https://baike.baidu.com/item/集合" target="_blank" rel="noopener">集合</a>中某一<a href="https://baike.baidu.com/item/对象/17158" target="_blank" rel="noopener">对象</a>（例如：<a href="https://baike.baidu.com/item/比特/3431582" target="_blank" rel="noopener">比特</a>模式、<a href="https://baike.baidu.com/item/自然数/385394" target="_blank" rel="noopener">自然数</a><a href="https://baike.baidu.com/item/序列/1302588" target="_blank" rel="noopener">序列</a>、8位组或者<a href="https://baike.baidu.com/item/电脉冲/10706490" target="_blank" rel="noopener">电脉冲</a>），以便<a href="https://baike.baidu.com/item/文本/5443630" target="_blank" rel="noopener">文本</a>在<a href="https://baike.baidu.com/item/计算机/140338" target="_blank" rel="noopener">计算机</a>中存储和通过<a href="https://baike.baidu.com/item/通信" target="_blank" rel="noopener">通信</a><a href="https://baike.baidu.com/item/网络" target="_blank" rel="noopener">网络</a>的传递。unicode，utf-8，gbk </p>
<h3 id="5、类型转换（不包含boolean）"><a href="#5、类型转换（不包含boolean）" class="headerlink" title="5、类型转换（不包含boolean）"></a>5、类型转换（不包含boolean）</h3><h4 id="1、自动类型转换"><a href="#1、自动类型转换" class="headerlink" title="1、自动类型转换"></a>1、自动类型转换</h4><p>当容量小的数据类型的变量与容量大的数据类型的变量做运算，结果自动提升为容量大的数据类型。当byte/short/chart三种变量做运算时提升为int类型。</p>
<p>byte 、  short   、chart  –&gt;  int  –&gt;  long  –&gt;  float  –&gt;  double</p>
<h4 id="2、强制类型转换"><a href="#2、强制类型转换" class="headerlink" title="2、强制类型转换"></a>2、强制类型转换</h4><p>大容量的数据类型的变量赋值给小容量的数据类型，通过一对”(被转数据类型)”进行强转。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study01;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 类型转换</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-08-29 20:34</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">NumberTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="comment">//小类型赋值给大类型，自动类型提升</span></span><br><span class="line">        <span class="keyword">byte</span> s = <span class="number">2</span>;</span><br><span class="line">        <span class="keyword">int</span> s1 = <span class="number">120</span>;</span><br><span class="line">        <span class="keyword">int</span> s2 = s + s1;</span><br><span class="line">        System.out.println(s2);</span><br><span class="line">		<span class="comment">//强制类型转换</span></span><br><span class="line">        <span class="keyword">double</span> s3 = <span class="number">12.3</span>;</span><br><span class="line">        <span class="keyword">float</span> s4 = (<span class="keyword">float</span>) s3;</span><br><span class="line">        System.out.println(s4);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>说明：容量大小指的是表示数的范围。</p>
<h3 id="6、String-字符串类型"><a href="#6、String-字符串类型" class="headerlink" title="6、String 字符串类型"></a>6、String 字符串类型</h3><p>String是引用数据类型，不是基本数据类型，声明使用一对”内容”。</p>
<p>String可以和8种数据类型做运算  +  法，连接运算，运算的结果为String类型。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study01;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-08-29 21:19</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">StringTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        String s1 = <span class="string">"66666"</span>;</span><br><span class="line">        <span class="keyword">int</span> num = <span class="number">123</span>;</span><br><span class="line"></span><br><span class="line">       <span class="comment">//字符串连接符 +</span></span><br><span class="line">        String s2 = s1 + num;</span><br><span class="line">        System.out.println(s2);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="7、进制的转换"><a href="#7、进制的转换" class="headerlink" title="7、进制的转换"></a>7、进制的转换</h3><p>二进制：0，1 ，满2进1，以0b/0B开头</p>
<p>十进制：0-9，满10进1</p>
<p>八进制:0-7,满8进一，以数字0开头表示</p>
<p>十六进制：0-9即A-F，满16进1，以0x/0X开头，此处的A-F不区分大小写。</p>
<p>最高位为符号位，0表示正数，1表示负数。</p>
<p>原码：直接将一个数值换成二进制数，最高位为符号位。</p>
<p>负数的反码：是对原码按位取反，最高位符号位为1</p>
<p>负数的补码：其反码+1</p>
<p>正数的原码、反码、补码三码合一</p>
<p>计算机底层都以补码的形式存储数据</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study01;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 进制</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-08-29 21:43</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">BinarnyTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">int</span> num = <span class="number">0b1100</span>;<span class="comment">//二进制以0b开头 0.1</span></span><br><span class="line">        <span class="keyword">int</span> num1 = <span class="number">123</span>;<span class="comment">//十进制0-9</span></span><br><span class="line">        <span class="keyword">int</span> num2 = <span class="number">012357</span>;<span class="comment">//八进制以0开头 0-7</span></span><br><span class="line">        <span class="keyword">int</span> num3 = <span class="number">0x23F</span>;<span class="comment">//十六进制以0x开头 0-9 A-F</span></span><br><span class="line">        <span class="comment">//以十进制输出</span></span><br><span class="line">        System.out.println(num);<span class="comment">//12</span></span><br><span class="line">        System.out.println(num1);<span class="comment">//123</span></span><br><span class="line">        System.out.println(num2);<span class="comment">//5359</span></span><br><span class="line">        System.out.println(num3);<span class="comment">//575</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="8、运算符"><a href="#8、运算符" class="headerlink" title="8、运算符"></a>8、运算符</h3><h4 id="1、算术运算符"><a href="#1、算术运算符" class="headerlink" title="1、算术运算符"></a>1、算术运算符</h4><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study01;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-08-30 9:29</span></span><br><span class="line"><span class="comment"> * + 正号  - 负号  + 加  - 减  * 乘  / 除（取整） %（取模） 取余</span></span><br><span class="line"><span class="comment"> *  ++ （前后）加加 -- （前后）减减   + 字符串拼接</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">MathTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="comment">//除法取整</span></span><br><span class="line">        <span class="keyword">int</span> num = <span class="number">12</span>;</span><br><span class="line">        <span class="keyword">int</span> num1 = <span class="number">5</span>;</span><br><span class="line">        <span class="keyword">int</span> num2 = -<span class="number">19</span>;</span><br><span class="line">        <span class="keyword">int</span> num3 = num/num1;</span><br><span class="line">        <span class="keyword">int</span> num4 = num/num1*num1;</span><br><span class="line">        <span class="comment">//模取余，结果的符号与被模数相同</span></span><br><span class="line">        <span class="comment">//取模结果为0，表示能被除尽，常用于判断。</span></span><br><span class="line">        <span class="keyword">int</span> num5 = num%num1;</span><br><span class="line">        <span class="keyword">int</span> num6 = num2%num1;</span><br><span class="line">        System.out.println(num3);<span class="comment">//2</span></span><br><span class="line">        System.out.println(num4);<span class="comment">//10</span></span><br><span class="line">        System.out.println(num5);<span class="comment">//2</span></span><br><span class="line">        System.out.println(num6);<span class="comment">//-4</span></span><br><span class="line"></span><br><span class="line">        <span class="comment">//前++:先自增再运算 后++：先运算再自增</span></span><br><span class="line">        <span class="keyword">int</span> num7 = num1++;</span><br><span class="line">        <span class="keyword">int</span> num8 = ++num1;</span><br><span class="line">        System.out.println(num7);<span class="comment">//5</span></span><br><span class="line">        System.out.println(num8);<span class="comment">//7</span></span><br><span class="line"></span><br><span class="line">        <span class="comment">//都自增，没有区别</span></span><br><span class="line">        num++;</span><br><span class="line">        System.out.println(num);<span class="comment">//13</span></span><br><span class="line">        ++num;</span><br><span class="line">        System.out.println(num);<span class="comment">//14</span></span><br><span class="line"></span><br><span class="line">        <span class="comment">//++自增不会改变自身的数据类型  --自减类似于自增运算，就是减法</span></span><br><span class="line">        <span class="comment">//+=有隐式的自动类型转换</span></span><br><span class="line">        <span class="keyword">short</span> num10 = <span class="number">12</span>;</span><br><span class="line">        num10 += <span class="number">1</span> ;<span class="comment">//相当于 num10 = num10+1;编译报错，将int类型的变量赋值给short,损失精度。</span></span><br><span class="line">        System.out.println(num10);<span class="comment">//13</span></span><br><span class="line"></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="2、赋值运算符"><a href="#2、赋值运算符" class="headerlink" title="2、赋值运算符"></a>2、赋值运算符</h4> <figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study01;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 赋值运算符 =  支持连续赋值</span></span><br><span class="line"><span class="comment"> * 当=号两侧数据类型不一致时，可以使用自定类型转换或者强制类型转换进行处理。</span></span><br><span class="line"><span class="comment"> * 扩展运算符：+= -= /= *= %=</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-08-30 10:02</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">FuZhiTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="comment">//连续赋值</span></span><br><span class="line">        <span class="keyword">int</span> num1,num2;</span><br><span class="line">        <span class="keyword">int</span> i1 = <span class="number">10</span>,i2=<span class="number">20</span>;</span><br><span class="line">        num1 = num2 = <span class="number">10</span>;</span><br><span class="line">        System.out.println(num1);<span class="comment">//10</span></span><br><span class="line">        System.out.println(num2);<span class="comment">//10</span></span><br><span class="line">        System.out.println(i1);<span class="comment">//10</span></span><br><span class="line">        System.out.println(i2);<span class="comment">//20</span></span><br><span class="line"></span><br><span class="line">        num1 += <span class="number">10</span>;</span><br><span class="line">        System.out.println(num1);<span class="comment">//20</span></span><br><span class="line"></span><br><span class="line">        <span class="comment">//推荐加1、加2写法 num++ num += 2</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="3、比较运算符（关系运算符）"><a href="#3、比较运算符（关系运算符）" class="headerlink" title="3、比较运算符（关系运算符）"></a>3、比较运算符（关系运算符）</h4><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study01;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 比较运算符,运算的结果是boolean类型，不是true就是false</span></span><br><span class="line"><span class="comment"> *  == 等于 != 不等于 &lt; 小于  &gt; 大于  &lt;=  小于等于 &gt;= 大于等于 instaceof 检查是否是类的对象</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-08-30 10:21</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">CompaireTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">int</span> i = <span class="number">10</span>;</span><br><span class="line">        <span class="keyword">int</span> j = <span class="number">20</span>;</span><br><span class="line">        System.out.println(i == j); <span class="comment">//fasle</span></span><br><span class="line">        System.out.println(<span class="number">4</span>&gt;=<span class="number">3</span>);<span class="comment">//true</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="4、逻辑运算符"><a href="#4、逻辑运算符" class="headerlink" title="4、逻辑运算符"></a>4、逻辑运算符</h4><table>
<thead>
<tr>
<th align="center">a</th>
<th align="center">b</th>
<th align="center">a&amp;b</th>
<th align="center">a&amp;&amp;b</th>
<th align="center">a|b</th>
<th align="center">a||b</th>
<th align="center">!a</th>
<th align="center">a^b</th>
</tr>
</thead>
<tbody><tr>
<td align="center">true</td>
<td align="center">fasle</td>
<td align="center">fasle</td>
<td align="center">fasle</td>
<td align="center">true</td>
<td align="center">true</td>
<td align="center">fasle</td>
<td align="center">true</td>
</tr>
<tr>
<td align="center">true</td>
<td align="center">true</td>
<td align="center">true</td>
<td align="center">true</td>
<td align="center">true</td>
<td align="center">true</td>
<td align="center">fasle</td>
<td align="center">fasle</td>
</tr>
<tr>
<td align="center">false</td>
<td align="center">true</td>
<td align="center">false</td>
<td align="center">false</td>
<td align="center">true</td>
<td align="center">true</td>
<td align="center">true</td>
<td align="center">true</td>
</tr>
<tr>
<td align="center">false</td>
<td align="center">false</td>
<td align="center">false</td>
<td align="center">false</td>
<td align="center">false</td>
<td align="center">false</td>
<td align="center">true</td>
<td align="center">fasle</td>
</tr>
</tbody></table>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study01;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 逻辑运算符：操作boolean类型的变量</span></span><br><span class="line"><span class="comment"> * &amp; 逻辑与   | 逻辑或  ! 逻辑非</span></span><br><span class="line"><span class="comment"> * &amp;&amp; 短路与   || 短路或    ^ 异或 相同为false/不同为true</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-08-30 13:03</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">LuojiTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">boolean</span> b1 = <span class="keyword">true</span>;</span><br><span class="line">        <span class="keyword">boolean</span> b2 = <span class="keyword">false</span>;</span><br><span class="line">        System.out.println(b1&amp;b2);<span class="comment">//false</span></span><br><span class="line">        System.out.println(b1&amp;&amp;b2);<span class="comment">//false</span></span><br><span class="line">        System.out.println(!b2);<span class="comment">//true</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="5、位运算符"><a href="#5、位运算符" class="headerlink" title="5、位运算符"></a>5、位运算符</h4><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study01;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 位运算符：&gt;&gt; 右移除 2^位数幂    &lt;&lt; 左移乘 2^位数幂</span></span><br><span class="line"><span class="comment"> * &gt;&gt;&gt;无符号右移  &amp; 与运算   | 或运算</span></span><br><span class="line"><span class="comment"> * ^ 异或运算（一个数异或另一个数两次，仍为原来的数）   ~取反运算（按位取反，包括符号位）</span></span><br><span class="line"><span class="comment"> * 都是操作整型的变量的数据</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-08-30 13:26</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">WeiYunSunTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">int</span> num = <span class="number">12</span>;</span><br><span class="line">        <span class="keyword">int</span> num1 =<span class="number">18</span>;</span><br><span class="line"></span><br><span class="line">        System.out.println(num&lt;&lt;<span class="number">2</span>);<span class="comment">//48</span></span><br><span class="line">        System.out.println(num&gt;&gt;<span class="number">2</span>);<span class="comment">//3</span></span><br><span class="line">        System.out.println(num^<span class="number">8</span>^<span class="number">8</span>);<span class="comment">//12</span></span><br><span class="line"></span><br><span class="line">        <span class="keyword">int</span> temp;</span><br><span class="line">        temp = num;</span><br><span class="line">        num = num1;</span><br><span class="line">        num1 = temp;</span><br><span class="line"></span><br><span class="line">        System.out.println(num);<span class="comment">//18</span></span><br><span class="line">        System.out.println(num1);<span class="comment">//12</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="6、三元运算符"><a href="#6、三元运算符" class="headerlink" title="6、三元运算符"></a>6、三元运算符</h4><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study01;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 三元运算符：变量 = 条件表达式1？表达式2：表达式3；</span></span><br><span class="line"><span class="comment"> * 条件表达式的结果为boolean类型</span></span><br><span class="line"><span class="comment"> * 如果条件表达式为true，执行表达式2。</span></span><br><span class="line"><span class="comment"> * 如果条件表达式为false，执行表达式3。</span></span><br><span class="line"><span class="comment"> * 表达式2/3要求是一致的 三元运算符是可以嵌套的</span></span><br><span class="line"><span class="comment"> * 凡是可以使用三元运算符的地方都可以改写成if...else...结构，反之则不一定成立。</span></span><br><span class="line"><span class="comment"> * 如果程序既可以使用三元运算符又可以使用if...else...建议使用三元运算符，简洁、效率较高</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-08-30 14:02</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">SanYuanYunSuanTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">int</span> num = <span class="number">10</span>&lt;<span class="number">0</span>?<span class="number">120</span>:(<span class="number">2</span>&gt;<span class="number">1</span>?<span class="number">100</span>:<span class="number">120</span>);<span class="comment">//三元运算符的嵌套</span></span><br><span class="line">        System.out.println(num);<span class="comment">//100</span></span><br><span class="line"></span><br><span class="line">        <span class="keyword">int</span> max = <span class="number">18</span>;</span><br><span class="line">        <span class="keyword">int</span> min = <span class="number">2</span>;</span><br><span class="line">        <span class="keyword">int</span> n = (max&gt;min)?max:min;</span><br><span class="line">        System.out.println(n);<span class="comment">//18</span></span><br><span class="line"></span><br><span class="line">        <span class="comment">//获取三个数中的最大值</span></span><br><span class="line">        <span class="keyword">int</span> num1 = <span class="number">5</span>;</span><br><span class="line">        <span class="keyword">int</span> num2 = <span class="number">8</span>;</span><br><span class="line">        <span class="keyword">int</span> num3 = <span class="number">13</span>;</span><br><span class="line">        <span class="keyword">int</span> max1 = (num1&gt;num2)?num1:num2;</span><br><span class="line">        <span class="keyword">int</span> max2 = (max1&gt;num3)?max1:num3;</span><br><span class="line">        System.out.println(max2);<span class="comment">//13</span></span><br><span class="line"></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="7、运算符的优先级"><a href="#7、运算符的优先级" class="headerlink" title="7、运算符的优先级"></a>7、运算符的优先级</h4><p>如果想要部分运算优先，可以使用（）括起来，使其优先级提高。具体的优先级排序没有必要记。</p>
<h3 id="9、流程控制（顺序结构、分支结构、循环结构）"><a href="#9、流程控制（顺序结构、分支结构、循环结构）" class="headerlink" title="9、流程控制（顺序结构、分支结构、循环结构）"></a>9、流程控制（顺序结构、分支结构、循环结构）</h3><h4 id="1、if…else"><a href="#1、if…else" class="headerlink" title="1、if…else.."></a>1、if…else..</h4> <figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study01;</span><br><span class="line"><span class="keyword">import</span> java.util.Scanner;</span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 分支结构：if...else...单选一、二选一、多选一</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-08-30 14:43</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">IfElseTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">boolean</span> flag = <span class="keyword">false</span>;</span><br><span class="line">        <span class="keyword">if</span> (flag)&#123;</span><br><span class="line">            System.out.println(<span class="string">"Java是世界上最好的语言"</span>);</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">if</span>(flag)&#123;</span><br><span class="line">            System.out.println(<span class="string">"good good study"</span>);</span><br><span class="line">        &#125;<span class="keyword">else</span> &#123;</span><br><span class="line">            System.out.println(<span class="string">"day day up"</span>);</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">int</span> num = <span class="number">60</span>;</span><br><span class="line">        <span class="keyword">if</span>(num&gt;<span class="number">60</span>)&#123;</span><br><span class="line">            System.out.println(<span class="string">"1"</span>);</span><br><span class="line">        &#125;<span class="keyword">else</span> <span class="keyword">if</span>(num&gt;<span class="number">70</span>)&#123;</span><br><span class="line">            System.out.println(<span class="string">"2"</span>);</span><br><span class="line">        &#125;<span class="keyword">else</span>&#123;</span><br><span class="line">            System.out.println(<span class="string">"3"</span>);</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//从键盘获取值</span></span><br><span class="line">        System.out.println(<span class="string">"请输出年龄"</span>);</span><br><span class="line">        Scanner scanner = <span class="keyword">new</span> Scanner(System.in);</span><br><span class="line">        <span class="comment">//如果输出的内容与要求的类型不匹配，产生异常InputMismatchException</span></span><br><span class="line">        <span class="keyword">int</span> age = scanner.nextInt();</span><br><span class="line">        System.out.println(<span class="string">"年龄："</span>+age);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="2、switch…case…"><a href="#2、switch…case…" class="headerlink" title="2、switch…case…"></a>2、switch…case…</h4><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study01;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Scanner;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * switch...case..</span></span><br><span class="line"><span class="comment"> * switch(表达式)&#123;</span></span><br><span class="line"><span class="comment"> *     case 常量：</span></span><br><span class="line"><span class="comment"> *          语句；</span></span><br><span class="line"><span class="comment"> *          break;</span></span><br><span class="line"><span class="comment"> *     case 常量：</span></span><br><span class="line"><span class="comment"> *         语句；</span></span><br><span class="line"><span class="comment"> *         break;</span></span><br><span class="line"><span class="comment"> *     default:</span></span><br><span class="line"><span class="comment"> *         语句；</span></span><br><span class="line"><span class="comment"> * &#125;</span></span><br><span class="line"><span class="comment"> * 表达式中的值依次匹配case后面的常量，如果匹配成功，则执行里面的语句，break退出整个switch结构。</span></span><br><span class="line"><span class="comment"> * 如果没有break，就会穿透执行每个case里面的语句，直到执行完或者遇到break。</span></span><br><span class="line"><span class="comment"> * 表示式只能是如下类型：byte short int char 枚举类型(JDk5.0新增) String（JDK7.0新增）</span></span><br><span class="line"><span class="comment"> * case只能声明常量，不能声明范围、</span></span><br><span class="line"><span class="comment"> * break关键字是可选的</span></span><br><span class="line"><span class="comment"> * default结构是可选的，而且位置是灵活的。</span></span><br><span class="line"><span class="comment"> * 凡是可以使用switch-case的结构，都可以转成if-else,反之不成立。两个能够同时使用，且case情况 较少，那么使用switch-case,结构清晰，效率较高。</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-08-30 15:15</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">SwitchCaseTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        Scanner scanner = <span class="keyword">new</span> Scanner(System.in);</span><br><span class="line">        System.out.println(<span class="string">"请输入你的年龄："</span>);</span><br><span class="line">        <span class="keyword">int</span> i = scanner.nextInt();</span><br><span class="line">        <span class="keyword">switch</span>(i)&#123;</span><br><span class="line">            <span class="keyword">case</span> <span class="number">20</span>:</span><br><span class="line">                System.out.println(<span class="string">"20岁不小了！"</span>);</span><br><span class="line">                <span class="keyword">break</span>;</span><br><span class="line">            <span class="keyword">case</span> <span class="number">30</span>:</span><br><span class="line">                System.out.println(<span class="string">"要生孩子了！"</span>);</span><br><span class="line">                <span class="keyword">break</span>;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="3、for"><a href="#3、for" class="headerlink" title="3、for"></a>3、for</h4><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study01;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 循环结构的4要素</span></span><br><span class="line"><span class="comment"> * 初始化条件</span></span><br><span class="line"><span class="comment"> * 循环条件是boolean类型</span></span><br><span class="line"><span class="comment"> * 循环体</span></span><br><span class="line"><span class="comment"> * 迭代条件</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-08-31 8:37</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ForTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>;i&lt;<span class="number">10</span>;i++)&#123;</span><br><span class="line">            System.out.println(<span class="string">"循环了"</span>+(i+<span class="number">1</span>)+<span class="string">"次！！"</span>);</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//遍历100以内的偶数</span></span><br><span class="line">        <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">0</span>;i&lt;=<span class="number">100</span>;i++)&#123;</span><br><span class="line">            <span class="keyword">if</span>(i%<span class="number">2</span> == <span class="number">0</span>)&#123;</span><br><span class="line">                System.out.println(i);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="4、while"><a href="#4、while" class="headerlink" title="4、while"></a>4、while</h4><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study02;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * while循环</span></span><br><span class="line"><span class="comment"> * 迭代条件丢失，会产生死循环。</span></span><br><span class="line"><span class="comment"> * 编码中应避免死循环</span></span><br><span class="line"><span class="comment"> * for循环和while循环可以相互转换。但是两者的初始化条件变量的作用域不一样</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-09-02 12:14</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">whileTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">int</span> num = <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">while</span> (num&lt;<span class="number">100</span>)&#123;</span><br><span class="line">            System.out.println(num);</span><br><span class="line">            num++;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="5、do…while…"><a href="#5、do…while…" class="headerlink" title="5、do…while…"></a>5、do…while…</h4><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study02;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * do&#123;</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * &#125;while();</span></span><br><span class="line"><span class="comment"> * 会至少执行一次循环体</span></span><br><span class="line"><span class="comment"> * 实际开发中经常使用for/while循环结构较多，不太实用do...while..</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-09-02 12:23</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">DoWhileTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">int</span> num = <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">do</span> &#123;</span><br><span class="line">            System.out.println(num);</span><br><span class="line">            num++;</span><br><span class="line">        &#125;<span class="keyword">while</span>(num&lt;<span class="number">100</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study02;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Scanner;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 键盘输出不确定的整数，记录输入的正数和负数的个数，并显示</span></span><br><span class="line"><span class="comment"> * 当输入为0时程序终止/</span></span><br><span class="line"><span class="comment"> * 跳出循环的方法：迭代条件不满足或者调用break</span></span><br><span class="line"><span class="comment"> * 死循环的写法：for(;;)&#123;&#125;   while(true)&#123;&#125;</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-09-02 20:53</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ForWhileTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        Scanner scanner = <span class="keyword">new</span> Scanner(System.in);</span><br><span class="line">        <span class="comment">//局部变量的声明一定要赋值。</span></span><br><span class="line">        <span class="keyword">int</span> count = <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">int</span> total = <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">while</span> (<span class="keyword">true</span>)&#123;</span><br><span class="line">            <span class="keyword">int</span> number = scanner.nextInt();</span><br><span class="line">            <span class="keyword">if</span>(number&gt;<span class="number">0</span>)&#123;</span><br><span class="line">                count++;</span><br><span class="line">            &#125;<span class="keyword">else</span> <span class="keyword">if</span>(number&lt;<span class="number">0</span>)&#123;</span><br><span class="line">                total++;</span><br><span class="line">            &#125;<span class="keyword">else</span>&#123;</span><br><span class="line">                <span class="keyword">break</span>;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        System.out.println(count);</span><br><span class="line">        System.out.println(total);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="6、嵌套循环"><a href="#6、嵌套循环" class="headerlink" title="6、嵌套循环"></a>6、嵌套循环</h4><p>​    将一个循环结构声明在另一个循环的循环体中，分为内层循环和外层循环。</p>
<p>​    注意：尽量不要超过三层</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study02;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 输出100以内的质数</span></span><br><span class="line"><span class="comment"> * 质数：只能被1和它本身整除的自然数--&gt;从2开始到这个数减一结束都不能被整除</span></span><br><span class="line"><span class="comment"> * 最小的质数是2</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-09-02 21:24</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ZhuShuTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">boolean</span> flag = <span class="keyword">true</span>;</span><br><span class="line">        <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">2</span>;i&lt;=<span class="number">100</span>;i++)&#123;</span><br><span class="line">            <span class="comment">//用i除以每个2到i-1之间的数</span></span><br><span class="line">            <span class="keyword">for</span>(<span class="keyword">int</span> k = <span class="number">2</span>;k&lt;i;k++)&#123;</span><br><span class="line">                <span class="comment">//如果有一个数被除尽了，那么i就不是质数</span></span><br><span class="line">                <span class="keyword">if</span>(i%k == <span class="number">0</span>)&#123;</span><br><span class="line">                  flag = <span class="keyword">false</span>;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="comment">//不是质数flag为false.不输出</span></span><br><span class="line">            <span class="keyword">if</span>(flag)&#123;</span><br><span class="line">                System.out.println(i);</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="comment">//每判断完一个数之后，将falg重置为true,以便进行下一个数的判断。</span></span><br><span class="line">            flag = <span class="keyword">true</span>;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study02;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 输出100以内的质数的优化方案</span></span><br><span class="line"><span class="comment"> * 质数：只能被1和它本身整除的自然数--&gt;从2开始到这个数减一结束都不能被整除</span></span><br><span class="line"><span class="comment"> * 最小的质数是2</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-09-02 21:24</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ZhuShuTest2</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">long</span> start = System.currentTimeMillis();</span><br><span class="line">        <span class="keyword">boolean</span> flag = <span class="keyword">true</span>;</span><br><span class="line">        <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">2</span>;i&lt;=<span class="number">100000</span>;i++)&#123;</span><br><span class="line">            <span class="comment">//用i除以每个2到i-1之间的数</span></span><br><span class="line">            <span class="keyword">for</span>(<span class="keyword">int</span> k = <span class="number">2</span>;k&lt;=Math.sqrt(i);k++)&#123;<span class="comment">//优化二</span></span><br><span class="line">                <span class="comment">//如果有一个数被除尽了，那么i就不是质数</span></span><br><span class="line">                <span class="keyword">if</span>(i%k == <span class="number">0</span>)&#123;</span><br><span class="line">                  flag = <span class="keyword">false</span>;</span><br><span class="line">                 <span class="keyword">break</span>;<span class="comment">//优化一：如果有一个数已经被整除，就不是质数，后面的就不用判断了。</span></span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="comment">//不是质数flag为false.不输出</span></span><br><span class="line">            <span class="keyword">if</span>(flag)&#123;</span><br><span class="line">                System.out.println(i);</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="comment">//每判断完一个数之后，将falg重置为true,以便进行下一个数的判断。</span></span><br><span class="line">            flag = <span class="keyword">true</span>;</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">long</span> end = System.currentTimeMillis();</span><br><span class="line">        System.out.println(<span class="string">"耗时： "</span>+(end-start)+<span class="string">"ms"</span>);<span class="comment">//16759 1692 91</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="7、break-continue"><a href="#7、break-continue" class="headerlink" title="7、break/continue"></a>7、break/continue</h4><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study02;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * break:使用在switch...case...或者循环结构中，结束当前循环。</span></span><br><span class="line"><span class="comment"> * continue：使用在循环结构中，结束当次循环。</span></span><br><span class="line"><span class="comment"> * 两者后面都不能声明执行语句,嵌套循环break只跳出内层循环，continue只结束内层的当次循环。</span></span><br><span class="line"><span class="comment"> * 可以使用给循环起别名，用于操作指定的循环结构。</span></span><br><span class="line"><span class="comment"> * return 用于结束循环或者结束方法</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-09-02 22:18</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">BreakContinueTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        label:<span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">1</span>;i&lt;=<span class="number">10</span>;i++)&#123;</span><br><span class="line">            <span class="keyword">if</span>(i == <span class="number">4</span>)&#123;</span><br><span class="line">                <span class="comment">//break;//123</span></span><br><span class="line">                <span class="keyword">continue</span> label;<span class="comment">//1235678910</span></span><br><span class="line">            &#125;</span><br><span class="line">            System.out.println(i);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.project01;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Scanner;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-09-03 21:30</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Untily</span> </span>&#123;</span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">static</span> Scanner scanner = <span class="keyword">new</span> Scanner(System.in);</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 从键盘获取指定长度的字符串</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span></span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> String <span class="title">readKeyBorad</span><span class="params">(<span class="keyword">int</span> limit)</span> </span>&#123;</span><br><span class="line">        String line = <span class="string">""</span>;</span><br><span class="line">        <span class="keyword">while</span> (scanner.hasNext()) &#123;</span><br><span class="line">            line = scanner.nextLine();</span><br><span class="line">            <span class="keyword">if</span> (line.length() &lt; <span class="number">1</span> || line.length() &gt; limit) &#123;</span><br><span class="line">                System.out.println(<span class="string">"输入的长度不合法,不应超过："</span> + limit);</span><br><span class="line">                <span class="keyword">continue</span>;</span><br><span class="line">            &#125;<span class="keyword">else</span> &#123;</span><br><span class="line">                <span class="keyword">break</span>;</span><br><span class="line">            &#125;</span><br><span class="line"></span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> line;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="10、数组"><a href="#10、数组" class="headerlink" title="10、数组"></a>10、数组</h3><p>概念：数组是相同类型数据按一定顺序排列的集合，并使用一个名字命名，并通过编号的方式对这些数据进行统一管理。</p>
<p>特点：数组是有序排列的，数组的长度就是数组能保存元素的个数。 使用角标、索引来操作数组中的元素。</p>
<p>数组本身是引用类型的数据，而数组中的元素可以是任意数据类型，包括基本数据类型和引用数据类型。</p>
<p>创建数组对象会在内存中开辟一块连续的空间，而数组名中引用的是这块空间的首地址。</p>
<p>数组的长度一旦确定，就不能修改。</p>
<p>数组的分类：一维数组、二维数组/基本数据类型的数组、引用数据类型的数组。</p>
<p>数组异常：角标越界ArrayIndexOutOfBoundsExcetion、空指针异常NullPointerExcetion</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study03;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 一维数组</span></span><br><span class="line"><span class="comment"> * 一维数组的内存解析：引用类型的数据，通过内存地址找到对应的对象。</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-09-04 21:58</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ArrayTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="comment">//数组的声明，一旦初始化完成其长度就确定</span></span><br><span class="line">        <span class="keyword">int</span> [] arr = <span class="keyword">new</span> <span class="keyword">int</span>[<span class="number">10</span>];<span class="comment">//动态初始化</span></span><br><span class="line">        <span class="keyword">int</span> [] aee = <span class="keyword">new</span> <span class="keyword">int</span>[]&#123;<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>&#125;;<span class="comment">//静态初始化:初始化和元素的赋值同时进行</span></span><br><span class="line">        <span class="keyword">int</span> [] ass = &#123;<span class="number">2</span>,<span class="number">6</span>,<span class="number">10</span>&#125;;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//通过角标的方式调用指定位置的元素</span></span><br><span class="line">        <span class="comment">//arr[0] = 5;</span></span><br><span class="line">        <span class="comment">//System.out.println(arr[0]);//5</span></span><br><span class="line"></span><br><span class="line">        <span class="comment">//获取数组的长度</span></span><br><span class="line">        System.out.println(arr.length);<span class="comment">//10</span></span><br><span class="line"></span><br><span class="line">        <span class="comment">//如何遍历数组元素</span></span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt;aee.length ; i++) &#123;</span><br><span class="line">            System.out.println(aee[i]);<span class="comment">// 1 2 3</span></span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//数组元素的默认初始化值:</span></span><br><span class="line">        <span class="comment">/**</span></span><br><span class="line"><span class="comment">         * 数组元素是整型：0</span></span><br><span class="line"><span class="comment">         * 数组元素是浮点型：0.0</span></span><br><span class="line"><span class="comment">         * 数组元素是char类型：0 '\u0000'</span></span><br><span class="line"><span class="comment">         * 数组元素是布尔类型：false</span></span><br><span class="line"><span class="comment">         * 数组元素是引用数据类型：null</span></span><br><span class="line"><span class="comment">         */</span></span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt;arr.length; i++) &#123;</span><br><span class="line">            System.out.println(arr[i]);<span class="comment">//000000</span></span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">char</span> [] charArr = <span class="keyword">new</span> <span class="keyword">char</span>[<span class="number">5</span>];</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; charArr.length; i++) &#123;</span><br><span class="line">            System.out.println(charArr[i]);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study03;</span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 二维数组</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-09-04 22:53</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ErArrayTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="comment">//二维数组的声明</span></span><br><span class="line">        <span class="keyword">int</span> [][] arr = <span class="keyword">new</span> <span class="keyword">int</span>[<span class="number">3</span>][<span class="number">2</span>];</span><br><span class="line">        <span class="keyword">int</span> [][] ass = <span class="keyword">new</span> <span class="keyword">int</span>[][]&#123;&#123;<span class="number">1</span>,<span class="number">1</span>,<span class="number">2</span>&#125;,&#123;<span class="number">5</span>,<span class="number">96</span>,<span class="number">9</span>,&#125;&#125;;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//调用指定位置的元素</span></span><br><span class="line">        System.out.println(ass[<span class="number">0</span>][<span class="number">2</span>]);</span><br><span class="line"></span><br><span class="line">        <span class="comment">//遍历</span></span><br><span class="line">        <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">0</span>;i&lt;ass.length;i++)&#123;</span><br><span class="line">            <span class="keyword">for</span>(<span class="keyword">int</span> k = <span class="number">0</span> ;k&lt;ass[i].length;k++)&#123;</span><br><span class="line">                System.out.println(ass[i][k]);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//二维数组的元素初始化值：外层元素的初始化值为地址值，内层元素的初始化值与一维数组相同</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study03;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 杨辉三角：使用二维数组打印杨辉三角</span></span><br><span class="line"><span class="comment"> * 第一行有1个元素，第n行有n个元素</span></span><br><span class="line"><span class="comment"> * 从第三行开始，对于非第一个和非最后一个元素的元素：即</span></span><br><span class="line"><span class="comment"> * arr[j][k] = arr[j-1][k]+arr[j-1][k-1]</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-09-05 21:08</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">YangHuiTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">int</span> [][] arr = <span class="keyword">new</span> <span class="keyword">int</span> [<span class="number">10</span>][];</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt;arr.length; i++) &#123;</span><br><span class="line">           arr[i] = <span class="keyword">new</span> <span class="keyword">int</span> [i+<span class="number">1</span>];</span><br><span class="line">           <span class="comment">//给首末元素赋值</span></span><br><span class="line">            arr[i][<span class="number">0</span>] = arr[i][i] = <span class="number">1</span>;</span><br><span class="line">            <span class="keyword">if</span>(i&gt;<span class="number">1</span>)&#123;</span><br><span class="line">                <span class="keyword">for</span> (<span class="keyword">int</span> j = <span class="number">1</span>; j &lt; arr[i].length-<span class="number">1</span> ; j++) &#123;</span><br><span class="line">                    arr[i][j] = arr[i-<span class="number">1</span>][j]+arr[i-<span class="number">1</span>][j-<span class="number">1</span>];</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//遍历</span></span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt;arr.length ; i++) &#123;</span><br><span class="line">            <span class="keyword">for</span> (<span class="keyword">int</span> j = <span class="number">0</span>; j &lt; arr[i].length; j++) &#123;</span><br><span class="line">                System.out.print(arr[i][j]+<span class="string">"\t"</span>);</span><br><span class="line">            &#125;</span><br><span class="line">            System.out.println();</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study03;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 数组元素的赋值</span></span><br><span class="line"><span class="comment"> * 创建一个长度为6的int类型的数组，要求元素的值都在1-30之间</span></span><br><span class="line"><span class="comment"> * 且是随机赋值，同时要求各元素的值不相同</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-09-05 21:25</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ArrayTestFuZhi</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">int</span> [] arr = <span class="keyword">new</span> <span class="keyword">int</span> [<span class="number">6</span>];</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; arr.length; i++) &#123;</span><br><span class="line">            arr[i] = (<span class="keyword">int</span>) ((Math.random() * <span class="number">30</span>) + <span class="number">1</span>);</span><br><span class="line">            <span class="keyword">for</span> (<span class="keyword">int</span> j = <span class="number">0</span>; j &lt;i; j++) &#123;</span><br><span class="line">                <span class="keyword">if</span>(arr[i] == arr[j])&#123;</span><br><span class="line">                    i--;</span><br><span class="line">                    <span class="keyword">break</span>;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> num:arr) &#123;</span><br><span class="line">            System.out.println(num);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study04;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * $冒泡排序</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-09-10 21:32</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">BubbleTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">int</span> [] arr = &#123;<span class="number">23</span>,<span class="number">45</span>,<span class="number">5</span>,<span class="number">9</span>,<span class="number">36</span>,<span class="number">78</span>,<span class="number">52</span>,-<span class="number">56</span>,-<span class="number">2</span>,<span class="number">20</span>&#125;;</span><br><span class="line">        <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">0</span> ;i&lt;arr.length-<span class="number">1</span>;i++)&#123;</span><br><span class="line">            <span class="keyword">for</span>(<span class="keyword">int</span> k = <span class="number">0</span>;k&lt;arr.length-<span class="number">1</span>-i;k++)&#123;</span><br><span class="line">                <span class="keyword">if</span>(arr[k]&gt;arr[k+<span class="number">1</span>]) &#123;</span><br><span class="line">                    <span class="keyword">int</span> temp = arr[k];</span><br><span class="line">                    arr[k] = arr[k + <span class="number">1</span>];</span><br><span class="line">                    arr[k + <span class="number">1</span>] = temp;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">for</span>(<span class="keyword">int</span> num:arr)&#123;</span><br><span class="line">            System.out.print(num+<span class="string">"\t"</span>);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study04;</span><br><span class="line"><span class="keyword">import</span> java.util.Arrays;</span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * Arrays数组工具类测试</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-09-12 9:48</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ArraysTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">int</span> [] arr = &#123;<span class="number">23</span>,<span class="number">45</span>,<span class="number">5</span>,<span class="number">9</span>,<span class="number">36</span>,<span class="number">78</span>,<span class="number">52</span>,-<span class="number">56</span>,-<span class="number">2</span>,<span class="number">20</span>&#125;;</span><br><span class="line">        <span class="keyword">int</span> [] sts = &#123;<span class="number">23</span>,<span class="number">45</span>,<span class="number">8</span>,<span class="number">9</span>,<span class="number">36</span>,<span class="number">78</span>,<span class="number">52</span>,-<span class="number">56</span>,-<span class="number">2</span>,<span class="number">20</span>&#125;;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//判断是否相等</span></span><br><span class="line">        <span class="keyword">boolean</span> flag = Arrays.equals(arr, sts);</span><br><span class="line">        System.out.println(flag);</span><br><span class="line"></span><br><span class="line">        <span class="comment">//输出数组信息</span></span><br><span class="line">        String s = Arrays.toString(arr);</span><br><span class="line">        System.out.println(s);</span><br><span class="line"></span><br><span class="line">        <span class="comment">//将数组中的元素替换成指定的元素</span></span><br><span class="line">        Arrays.fill(arr,<span class="number">666</span>);</span><br><span class="line">        System.out.println(Arrays.toString(arr));</span><br><span class="line"></span><br><span class="line">        <span class="comment">//排序</span></span><br><span class="line">        Arrays.sort(sts);</span><br><span class="line">        System.out.println(Arrays.toString(sts));</span><br><span class="line"></span><br><span class="line">        <span class="comment">//二分查找,返回指定元素的索引</span></span><br><span class="line">        <span class="keyword">int</span> i = Arrays.binarySearch(sts, <span class="number">20</span>);</span><br><span class="line">        System.out.println(i);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="四、面向对象"><a href="#四、面向对象" class="headerlink" title="四、面向对象"></a>四、面向对象</h2><p>###　１、面向过程与面向对象对比</p>
<p>面向对象是相对于面向过程的，面向过程强调的是功能和行为，完成任务具体的方法和步骤，以函数作为最小单位。面向对象是将功能封装进对象，强调的是对象，通过调用对象完成具体的功能。并且面向的对象的思想更符合人们在日常生活中的思维习惯。</p>
<h3 id="２、面向对象的两个要素"><a href="#２、面向对象的两个要素" class="headerlink" title="２、面向对象的两个要素"></a>２、面向对象的两个要素</h3><p>类是对一类事务的描述，是抽象的概念上的定义。</p>
<p>对象是实际存在的该类事物的个体，因而也称为实例。</p>
<p>面对对象程序设计的重点是类的设计。设计类就是设计类的成员。</p>
<h3 id="3、类的成员"><a href="#3、类的成员" class="headerlink" title="3、类的成员"></a>3、类的成员</h3><p>属性：类中的成员变量   vs  局部变量</p>
<p>在类中声明的位置不同，直接定义在{}内的叫做属性。声明其属性时指明其权限，使用权限修饰符。</p>
<p>常用的权限修饰符：private-public-default-protected</p>
<p>声明在方法内、方法形参、代码块内、构造器形参、构造器内部的变量叫做局部变量。先声明后使用，都有对应的作用域。</p>
<p>方法：类中的成员方法，是否有形参、是否有返回值！</p>
<p>权限修饰符 返回值类型 方法名（形参列表）{ 方法体 }</p>
<p>如果有返回值，则在方法声明时指定返回值的类型。同时，方法中需要使用return关键字来返回指定类型的常量或者变量。如果没有返回值值，方法声明时使用void关键字，通常不使用return关键字，如果要使用则return;表示结束此方法。</p>
<p>return关键字的使用：</p>
<p>1、使用在方法体中</p>
<p>2、用于结束方法，针对有返回值类型的方法，使用return返回数据。</p>
<p>3、return关键字后不可以声明执行语句</p>
<p>方法的使用，可以调用当前类的属性和方法。方法内可以调用方法。</p>
<h3 id="4、万物皆对象"><a href="#4、万物皆对象" class="headerlink" title="4、万物皆对象"></a>4、万物皆对象</h3><p>在Java语言范畴中，我们都将功能、结构封装到类中，通过类的实例化，来调用具体的功能结构。</p>
<h3 id="5、匿名对象"><a href="#5、匿名对象" class="headerlink" title="5、匿名对象"></a>5、匿名对象</h3><p>创建的对象没有显示的命名，匿名对象只能调用一次。</p>
<h3 id="6、方法"><a href="#6、方法" class="headerlink" title="6、方法"></a>6、方法</h3><p>​    1、方法的重载</p>
<p>在同一个类中有多个方法名相同，参数列表不同的方法，叫做方法的重载(overload)。参数列表不同指类型不同、个数不同。跟方法的权限修饰符、 返回值类型、形参变量名、方法体无关。</p>
<h3 id="7、可变参数"><a href="#7、可变参数" class="headerlink" title="7、可变参数"></a>7、可变参数</h3><p>JDK5.0中提供了可变参数的机制，允许直接定义能和多个实参匹配的形参。</p>
<p>格式：参数类型…形参名称</p>
<p>当调用可变参数的方法时，传入的参数可以是0个、1个、多个。。。</p>
<p>可变参数可以与本类中，方法名相同，参数列表不同的方法构成重载。</p>
<p>可变参数相当于传入数组</p>
<p>可变个数形参在方法的形参中必须声明在末尾，并且只有一个！</p>
<h3 id="8、值传递机制"><a href="#8、值传递机制" class="headerlink" title="8、值传递机制"></a>8、值传递机制</h3><p>变量的赋值：如果是基本数据类型，赋值的变量所保存的数据值。如果变量是引用数据类型，赋值的变量所保存的地址值！</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.bean;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 单列设计模式 饿汉式 实现起来简单，没有多线程同步问题。耗费内存。</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-10-08 13:25</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Cat</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">private</span> <span class="title">Cat</span><span class="params">()</span></span>&#123;&#125;</span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">static</span> Cat catIns = <span class="keyword">new</span> Cat();</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> Cat <span class="title">getCatIns</span><span class="params">()</span></span>&#123;</span><br><span class="line">        <span class="keyword">return</span> catIns;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">package</span> com.ybjt.bean;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 单例设计模式 懒汉式 在多线程环境中，这种实现方法是完全错误的，根本不能保证单例的状态。</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-10-08 13:29</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Dog</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">private</span> <span class="title">Dog</span><span class="params">()</span></span>&#123;&#125;</span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">static</span> Dog dogIns = <span class="keyword">null</span>;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> Dog <span class="title">getDogIns</span><span class="params">()</span></span>&#123;</span><br><span class="line">        <span class="keyword">if</span>(dogIns != <span class="keyword">null</span>)&#123;</span><br><span class="line">            <span class="keyword">return</span> <span class="keyword">new</span> Dog();</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span>  dogIns;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">package</span> com.ybjt.bean;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 单例设计模式 懒汉式 线程安全</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-10-08 13:29</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Dog</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">private</span> <span class="title">Dog</span><span class="params">()</span></span>&#123;&#125;</span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">static</span> Dog dogIns = <span class="keyword">null</span>;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">synchronized</span> Dog <span class="title">getDogIns</span><span class="params">()</span></span>&#123;</span><br><span class="line">        <span class="keyword">if</span>(dogIns != <span class="keyword">null</span>)&#123;</span><br><span class="line">            <span class="keyword">return</span> <span class="keyword">new</span> Dog();</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span>  dogIns;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.bean;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 如果类的构造器或者静态方法工厂中有多个参数（四个参数以上），使用Builder</span></span><br><span class="line"><span class="comment"> * 构建者设计模式</span></span><br><span class="line"><span class="comment"> * 避免创建不必要的对象</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-10-08 13:43</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Car</span> </span>&#123;</span><br><span class="line">    <span class="keyword">private</span> String name;</span><br><span class="line">    <span class="keyword">private</span> String old;</span><br><span class="line">    <span class="keyword">private</span> String num;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">static</span> <span class="class"><span class="keyword">class</span> <span class="title">Bulider</span></span>&#123;</span><br><span class="line">        <span class="keyword">private</span> String name = <span class="string">"奥迪"</span>;</span><br><span class="line">        <span class="keyword">private</span> String old;</span><br><span class="line">        <span class="keyword">private</span> String num;</span><br><span class="line"></span><br><span class="line">        <span class="function"><span class="keyword">public</span> Bulider <span class="title">setOld</span><span class="params">(String old)</span></span>&#123;</span><br><span class="line">            <span class="keyword">this</span>.old = old;</span><br><span class="line">            <span class="keyword">return</span> <span class="keyword">this</span>;</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="function"><span class="keyword">public</span> Bulider <span class="title">setNum</span><span class="params">(String num)</span></span>&#123;</span><br><span class="line">            <span class="keyword">this</span>.num = num;</span><br><span class="line">            <span class="keyword">return</span> <span class="keyword">this</span>;</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="function"><span class="keyword">public</span> Car <span class="title">build</span><span class="params">()</span></span>&#123;</span><br><span class="line">            <span class="keyword">return</span> <span class="keyword">new</span> Car(<span class="keyword">this</span>);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">private</span> <span class="title">Car</span><span class="params">(Bulider bulider)</span></span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.name = bulider.name;</span><br><span class="line">        <span class="keyword">this</span>.old = bulider.old;</span><br><span class="line">        <span class="keyword">this</span>.num = bulider.num;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">toString</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> <span class="string">"Car&#123;"</span> +</span><br><span class="line">                <span class="string">"name='"</span> + name + <span class="string">'\''</span> +</span><br><span class="line">                <span class="string">", old='"</span> + old + <span class="string">'\''</span> +</span><br><span class="line">                <span class="string">", num='"</span> + num + <span class="string">'\''</span> +</span><br><span class="line">                <span class="string">'&#125;'</span>;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="9、封装性"><a href="#9、封装性" class="headerlink" title="9、封装性"></a>9、封装性</h3><p>隐藏对象内部的复杂性，只对外公开简单的接口，便于外界调用，提高系统的扩展性和可维护性，把该隐藏的隐藏起来，把该暴露的暴露出来，这就是封装性的设计思想。</p>
<p>封装性的体现：1、私有化属性，对外提供公开的get和set方法。2、不对外暴露的私有方法。3、单例设计模式。等。。。</p>
<p>封装性的体现需要权限修饰的配合，Java规定的四种权限修饰符(从小到大 )：</p>
<p>private 缺省 protected public</p>
<p>private 私有的，同一类的内部访问</p>
<p>不写就是缺省，同一包下都可以访问</p>
<p>protected受保护的，不同包的子类中都可以访问</p>
<p>public公开的，整个工程下都能访问</p>
<p>修饰类只能用public和缺省</p>
<p>4种权限修饰符来修饰类及类内部的结构，体现类及类内部结构在被调用时资源可见性的大小。</p>
<h3 id="10、构造器"><a href="#10、构造器" class="headerlink" title="10、构造器"></a>10、构造器</h3><p>1、构造器的作用：创建对象、初始化对象的信息</p>
<p>2、如果没有显式的定义构造器，系统会默认提供一个空参的构造器。一旦显式的定义了构造器，系统将不再提供默认的空参的构造器。</p>
<p>3、格式：权限修饰符 类名（形参列表）{}</p>
<p>4、类中定义的多个构造器，彼此构成重载。</p>
<p>类的属性赋值的先后顺序：①默认初始化②显式初始化③构造器赋值④对象.方法或者对象.属性的方式赋值</p>
<h3 id="11、JavaBean"><a href="#11、JavaBean" class="headerlink" title="11、JavaBean"></a>11、JavaBean</h3><p>java语言提供的可重用的组件，类是公共的，有一个无参的构造器，有多个属性且提供公共的get/set方法。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.bean;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.Serializable;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-07-24 15:50</span></span><br><span class="line"><span class="comment"> * 实体类，类的设计</span></span><br><span class="line"><span class="comment"> * 成员变量即类的属性</span></span><br><span class="line"><span class="comment"> * 局部变量声明在方法内、方法形参、代码块内、构造器形参、构造器内的变量</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">User</span> <span class="keyword">implements</span> <span class="title">Serializable</span> </span>&#123;</span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="keyword">long</span> serialVersionUID = -<span class="number">5555401105921349900L</span>;</span><br><span class="line">    <span class="keyword">private</span> String name;</span><br><span class="line">    <span class="keyword">private</span> String age;</span><br><span class="line">    <span class="keyword">private</span> String address;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">User</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 带参的构造器</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> name 名字</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> age 年龄</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> address 地址</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">User</span><span class="params">(String name, String age, String address)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.name = name;</span><br><span class="line">        <span class="keyword">this</span>.age = age;</span><br><span class="line">        <span class="keyword">this</span>.address = address;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getName</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> name;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setName</span><span class="params">(String name)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.name = name;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getAge</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> age;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setAge</span><span class="params">(String age)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.age = age;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getAddress</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> address;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setAddress</span><span class="params">(String address)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.address = address;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">toString</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> <span class="string">"com.ybjt.bean.User&#123;"</span> +</span><br><span class="line">                <span class="string">"name='"</span> + name + <span class="string">'\''</span> +</span><br><span class="line">                <span class="string">", age='"</span> + age + <span class="string">'\''</span> +</span><br><span class="line">                <span class="string">", address='"</span> + address + <span class="string">'\''</span> +</span><br><span class="line">                <span class="string">'&#125;'</span>;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">song</span><span class="params">()</span></span>&#123;</span><br><span class="line">        System.out.println(name+<span class="string">"跪着唱征服！"</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="12、this关键字"><a href="#12、this关键字" class="headerlink" title="12、this关键字"></a>12、this关键字</h3><p>三W学习法，what?why?how?</p>
<p>①this可以修饰属性和方法：当前对象或者当前正在创建的对象  this.name （属性）= name（形参）;</p>
<p>②this调用构造器：this(形参列表);通过形参列表指定调用本类的其他构造器（不能调用自己）。必须声明在当前构造器的首行！简化代码降低冗余！</p>
<h3 id="13、package"><a href="#13、package" class="headerlink" title="13、package"></a>13、package</h3><p>package 包 ：实现项目中类的管理，引入包的概念。声明类或者接口所属的包，声明在源文件的首行。属于标识符，遵循标识符的命名规范（全小写），见名知意。xxx.yyy.zzz 每”.”一次表示一层文件目录。同一个包下不能定义同名的类或者接口。</p>
<h3 id="14、MVC"><a href="#14、MVC" class="headerlink" title="14、MVC"></a>14、MVC</h3><p>MVC设计模式，M模型层、V视图层、C控制层。将程序输入输出、数据处理、一级数据展示分离开来的设计模式是程序结构变得灵活且清晰，同时也描述了各个程序之间的通信方式，降低了程序的耦合性。分层开发各司其职，程序员只需关注自己负责的部分代码，提高了代码的关注度，从而提高开发质量。</p>
<h3 id="15、import"><a href="#15、import" class="headerlink" title="15、import"></a>15、import</h3><p>导入：在源文件中，显示的导入指定包下的结构（类或接口）。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> java.until.String;</span><br><span class="line"><span class="keyword">import</span> java.util.*;<span class="comment">//*表示导入包下的所有结构</span></span><br><span class="line"><span class="keyword">import</span> <span class="keyword">static</span> XXX;<span class="comment">//导入指定类或者接口中的静态结构：属性和方法</span></span><br></pre></td></tr></table></figure>

<p>静态导入：import static 包名….类名.方法名; JDK1.5</p>
<p>A:方法必须是静态的</p>
<p>B:如果有多个同名的静态方法，容易不知道使用谁?这个时候要使用，必须加前缀</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//静态导入</span></span><br><span class="line"><span class="keyword">import</span> <span class="keyword">static</span> java.lang.Math.abs;</span><br><span class="line"><span class="keyword">import</span> <span class="keyword">static</span> java.lang.Math.pow;</span><br><span class="line"><span class="keyword">import</span> <span class="keyword">static</span> java.lang.Math.max;</span><br></pre></td></tr></table></figure>

<h3 id="16、继承性"><a href="#16、继承性" class="headerlink" title="16、继承性"></a>16、继承性</h3><p>①继承性的好处：减少代码冗余，提高代码复用性。便于功能的扩展。为多态的使用提供了前提。</p>
<p>②继承关键字: Class A extends Class B    A子类 B父类   ，A类中就能获取B类中所有的属性和方法。（父类中声明的private私有的属性和方法，子类继承后，仍然获取到了父类中的结构，只是因为封装性的影响，使得子类不能直接调用父类的私有的结构。）</p>
<p>③子类继承父类，还可以声明子类特有的属性和方法。实现功能的扩展。</p>
<p>④Java只支持类的单继承和多层继承，不允许多继承。（一个类可以被多个子类继承。一个类只能有一个父类。子父类是相对的概念。子类直接继承的类叫做直接父类，间接继承的类叫做间接父类，子类拥有直接父类和间接父类中所有的属性和方法。）</p>
<h3 id="17、Object类"><a href="#17、Object类" class="headerlink" title="17、Object类"></a>17、Object类</h3><p>所有的Java类，除java.lang.Object类外，都直接或者间接的继承Object类。</p>
<h3 id="18、方法的重写"><a href="#18、方法的重写" class="headerlink" title="18、方法的重写"></a>18、方法的重写</h3><p>①概念：在子类中可以根据需要对父类中继承的方法进行改造，也称方法的的重置、覆盖。在程序执行时，子类的方法将覆盖父类中的方法。</p>
<p>②子类对象调用重写父类的方法，执行的是子类重写的方法。</p>
<p>④重写的规定：约定俗成：子类中的方法叫重写的方法，父类中的叫被重写的方法。方法名和形参列表相同；重写方法的权限修饰符不小于被重写的方法；子类不能重写声明为private的方法；父类被重写的方法的返回值为void，那么子类重写的方法只能是void的；父类被重写的方法是A类的，子类重写方法的返回值可以A类在或者A类的子类；父类被重写的方法的返回值的是基本类型，子类重写方法的返回值与父类中的相同；子类重写的方法抛出的异常类型不大于父类被重写方法抛出的异常。</p>
<p>⑤子类和父类中的同名同参的方法，要么都声明为非static的（考虑重写）。要么都声明为static的（不能重写） </p>
<h3 id="19、supper关键字"><a href="#19、supper关键字" class="headerlink" title="19、supper关键字"></a>19、supper关键字</h3><p>①supper父类的，用来调用属性、方法、构造器</p>
<p>②在子类方法或者构造器中，使用supper.属性或者supper.方法名（）的方式，显式调用父类声明中的方法和属性，通常情况下省略supper.结构，但是当子父类中定义了同名的属性，如果使用父类的属性，就要显式的使用supper.属性的形式调用。父类方法的调用与属性相同！</p>
<p>③supper调用构造器：可以在子类的构造器中，使用supper（形参列表）的方式，显式的调用父类中的构造器。必须声明在子类构造器中的首行，this(形参列表)或者supper(形参列表)只能声明一个。两个都不写，系统会默认添加supper()调用父类中空参的构造器。</p>
<p>在类的多个构造器中，至少有一个构造器使用supper()调用父类的构造器，</p>
<h3 id="20、多态性"><a href="#20、多态性" class="headerlink" title="20、多态性"></a>20、多态性</h3><p>①理解：一个事物的多种形态；父类的引用指向子类的对象。</p>
<p>②多态的使用：当调用子父类的同名同参的方法时，实际执行的是子类重写父类的方法—虚拟方法调用</p>
<p>在编译期，只能调用父类声明的方法。但在运行期，实际执行的是子类重写父类的方法。（编译看左边，运行看右边）</p>
<p>③多态的使用前提：类的继承关系、方法的重写</p>
<p>④对象的多态性，只适用于方法，不使用属性。</p>
<h3 id="21、instanceof关键字"><a href="#21、instanceof关键字" class="headerlink" title="21、instanceof关键字"></a>21、instanceof关键字</h3><p>①向上转型：多态</p>
<p>②向下转型：强制类型转换（类型），使用instanceof判断类型是否一致！</p>
<h3 id="22、Object类和包装类"><a href="#22、Object类和包装类" class="headerlink" title="22、Object类和包装类"></a>22、Object类和包装类</h3><p>Object类是所有Java类的根父类； 如果在类的声明中未使用extends关键字指明其父类，则默认父类为Object类。Object类中定义的功能具有通用性，只声明了空参的构造器和通用方法。</p>
<p>==运算符：</p>
<p>①可以使用在基本数据类型变量和引用数据类型变量中</p>
<p>②如果比较的是基本数据类型变量，比较两个变量保存的数据是否相等（不一定类型要相同）；</p>
<p>如果比较的是引用数据类型的变量，比较的是两个对象的地址值是否相同;</p>
<p>equals()方法：</p>
<p>只适用于引用数据类型，Object类中的equals方法与==相等。但是其他类重写了equals方法，比较的是两份对象的内容是否相等，例如String类</p>
<p>toString()方法：</p>
<p>①当我们输出一个对象的引用时，实际上调用当前对象的toString方法。</p>
<p>②例如String/Date/File、包装类等都重写了Obejct类中的toString方法，使得调用对象的toString时，返回对象的实体内容。</p>
<p>③自定义类也可以重写toString方法，当调用方法时，返回对象的实体内容。</p>
<p>包装类的使用：</p>
<p>①针对八种基本数据类型，定义相应的引用类型—–包装类，使得基本数据类型的变量具有类的特征。</p>
<p>②基本数据类型、包装类、String之间的相互转换：</p>
<p>③JDK5.0的新特性：自动装箱、自动拆箱</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line">   	<span class="comment">//基本数据类型转换包装类，调用包装类的构造器</span></span><br><span class="line">      Integer in = <span class="keyword">new</span> Integer(<span class="number">3</span>);</span><br><span class="line">      <span class="comment">//基本数据类型转换包装类valueOf()方法</span></span><br><span class="line">      <span class="keyword">int</span> s = Integer.valueOf(<span class="number">1</span>);</span><br><span class="line">      System.out.println(in);</span><br><span class="line"></span><br><span class="line">      <span class="comment">//包装类转换成基本数据类型,xxxValue()</span></span><br><span class="line">      <span class="keyword">int</span> i = in.intValue();</span><br><span class="line">      System.out.println(i);</span><br><span class="line"></span><br><span class="line">      <span class="comment">//基本数据类型、包装类，转换成String</span></span><br><span class="line">      String str = <span class="number">1</span> + <span class="string">""</span>;</span><br><span class="line">      String s1 = String.valueOf(<span class="number">123</span>);</span><br><span class="line"></span><br><span class="line">      <span class="comment">//String 转换成基本数据类型或者包装类</span></span><br><span class="line">      <span class="keyword">int</span> i1 = Integer.parseInt(<span class="string">"345"</span>);</span><br><span class="line"></span><br><span class="line">      <span class="comment">//自动装箱 自动拆箱</span></span><br><span class="line">      Integer number = <span class="number">1</span>;  <span class="comment">//自动装箱</span></span><br><span class="line">      <span class="keyword">int</span> count = number;  <span class="comment">//自动拆箱</span></span><br><span class="line">      System.out.println(number);</span><br><span class="line">      System.out.println(count);</span><br><span class="line"></span><br><span class="line"><span class="comment">//Integer内部定了一个-128-127之间的256个数的数组，当在此范围之间时，</span></span><br><span class="line"><span class="comment">//直接使用数组中的元素，无需new，提升了效率。 </span></span><br><span class="line">Integer i3 = <span class="number">1</span>;</span><br><span class="line">       Integer i4 = <span class="number">1</span>;</span><br><span class="line">       System.out.println(i3 == i4);</span><br><span class="line"></span><br><span class="line">       Integer i5 = <span class="number">128</span>;</span><br><span class="line">       Integer i6 = <span class="number">128</span>;</span><br><span class="line">       System.out.println(i5 == i6);</span><br></pre></td></tr></table></figure>

<h3 id="22、static关键字"><a href="#22、static关键字" class="headerlink" title="22、static关键字"></a>22、static关键字</h3><p>①静态的，可以修饰属性、方法、代码块、内部类</p>
<p>②static修饰属性：静态变量，static修饰的属性为静态属性，每个对象公有此静态属性！没有被static修饰的属性为非静态属性（实例变量）每个对象独自拥有。</p>
<p>③静态变量随着类的加载而加载，静态变量的加载早于对象的创建。由于类只会被加载一次，则静态变量在内存中只会存在一份，存在方法区的静态域中。</p>
<p>④静态方法：使用static修饰的方法，随着类的加载而加载，可以使用类名.方法名（）的形式，直接调用！</p>
<p>静态方法中只能调用静态的方法或属性，非静态方法中既可以调用非静态的方法和属性又可以调用静态的方法和属性。</p>
<p>⑤在静态方法内不能使用this/supper关键字，</p>
<p>⑥在开发中如何确定属性和方法要不要声明成static的:</p>
<p>​    属性可以被多个对象共享，就可以声明成静态的。</p>
<p>​    操作静态属性的方法，通常声明为静态的。工具类中的方法通常声明为静态的。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"> <span class="comment">//常量的声明</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="keyword">int</span> NUM = <span class="number">10</span>;</span><br></pre></td></tr></table></figure>

<h3 id="23、单例设计模式"><a href="#23、单例设计模式" class="headerlink" title="23、单例设计模式"></a>23、单例设计模式</h3><p>①所谓单例设计模式，就是采取一定的方式保证在整个软件系统中，对某个类只能存在一个对象的实例。</p>
<p>②饿汉式vs懒汉式</p>
<p>③区别：</p>
<p>​    饿汉式：好处：线程安全     坏处：对象加载时间过长</p>
<p>​    懒汉式：好处：延迟对象的创建   坏处：线程不安全</p>
<h3 id="24、main方法的使用说明"><a href="#24、main方法的使用说明" class="headerlink" title="24、main方法的使用说明"></a>24、main方法的使用说明</h3><p>①作为程序的入口</p>
<p>②也是一个普通的静态方法</p>
<p>③可以作为我们与控制台交互的方式</p>
<h3 id="25、代码块"><a href="#25、代码块" class="headerlink" title="25、代码块"></a>25、代码块</h3><p>①代码块的作用：用来初始化类、对象</p>
<p>②代码块如果有修饰的话只能用static修饰：</p>
<p>静态代码块：随着类的加载而执行，而且只执行一次。可以初始化类的信息。如果一个类中定义了多个静态代码块，按声明的位置先后执行。只能调用静态的结构，不能调用非静态的结构。</p>
<p>非静态代码块：随着对象的创建而执行，每创建一个对象执行一次。可以在创建对象时对对象的属性等进行初始化。如果一个类中定义了多个非静态代码块，也按声明的位置先后执行。既可以调用非静态结构，又可以调用静态结构。</p>
<p>静态代码块的执行，优先于非静态的代码块。</p>
<p>对象属性赋值的先后顺序：</p>
<p>①默认初始化 ②显示初始化/代码块中赋值  ③构造器中初始化 ④创建对象后用：对象.属性 进行赋值</p>
<h3 id="26、final关键字"><a href="#26、final关键字" class="headerlink" title="26、final关键字"></a>26、final关键字</h3><p>①含义：最终的、最后的</p>
<p>②修饰类：此类不能被其他类继承，不能有子类。例如String/System/StringBuffer</p>
<p>③修饰方法：此方法不能被重写，例如Object类重的getClass()方法。</p>
<p>④修饰变量：此变量成为一个常量</p>
<p>final修饰属性： 考虑赋值的位置：显式初始化、 代码块中初始化、构造器中初始化、</p>
<p>final修饰局部变量和修饰形参时，表示是一个常量。当我们调用此方法时，给常量形参赋值，一旦赋值将再不能改变。</p>
<p>static final 修饰变量则为全局常量、修饰方法则为静态方法但是一般不加final，方法调用通过类型.方法（）调用。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//常量的声明</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> String AGE = <span class="string">"28"</span>;</span><br></pre></td></tr></table></figure>

<h3 id="27、抽象类和抽象方法"><a href="#27、抽象类和抽象方法" class="headerlink" title="27、抽象类和抽象方法"></a>27、抽象类和抽象方法</h3><p>①abstract抽象关键字，可以用来修饰类和方法。</p>
<p>②修饰类，叫做抽象类，此类不可实例化，抽象类中一定有构造器，便于子类实例化时使用。开发中都会提供抽象类的子类，当子类对象实例化，完成相关的操作。</p>
<p>③修饰方法，叫抽象方法，只有方法的声明没有方法体。包含抽象方法的类一定是一个抽象类，反之，抽象类中可以没有抽象方法。</p>
<p>④若子类重写了父类所有的抽象方法后方可实例化，如果没有全部重写，那么子类也是一个抽象类。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study06;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-01 15:18</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">AbstractTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        Man m = <span class="keyword">new</span> Man();</span><br><span class="line">        m.eat();</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//抽象类不能实例化，只能实例化子类</span></span><br><span class="line"><span class="keyword">abstract</span> <span class="class"><span class="keyword">class</span> <span class="title">Person</span></span>&#123;</span><br><span class="line">    <span class="comment">//抽象方法只有方法的声明</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">abstract</span> <span class="keyword">void</span> <span class="title">eat</span><span class="params">()</span></span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">Man</span> <span class="keyword">extends</span> <span class="title">Person</span></span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">eat</span><span class="params">()</span></span>&#123;</span><br><span class="line">        System.out.println(<span class="string">"我要吃好的！"</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>⑤abstract不能修饰 属性、构造器等结构，不能修饰私有方法、静态方法、final方法、final类。</p>
<p>⑥抽象类的匿名子类：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study06;</span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-01 15:44</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">AbsTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="comment">//抽象类的匿名子类</span></span><br><span class="line">        Animal a = <span class="keyword">new</span> Animal() &#123;</span><br><span class="line">            <span class="meta">@Override</span></span><br><span class="line">            <span class="function"><span class="keyword">void</span> <span class="title">eat</span><span class="params">()</span> </span>&#123;</span><br><span class="line">                System.out.println(<span class="string">"饭后"</span>);</span><br><span class="line">            &#125;</span><br><span class="line"></span><br><span class="line">            <span class="meta">@Override</span></span><br><span class="line">            <span class="function"><span class="keyword">void</span> <span class="title">walk</span><span class="params">()</span> </span>&#123;</span><br><span class="line">                System.out.println(<span class="string">"百步走"</span>);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;;</span><br><span class="line">       a.eat();</span><br><span class="line">       a.walk();</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//抽象类</span></span><br><span class="line"><span class="keyword">abstract</span> <span class="class"><span class="keyword">class</span> <span class="title">Animal</span></span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">abstract</span> <span class="keyword">void</span> <span class="title">eat</span><span class="params">()</span></span>;</span><br><span class="line">    <span class="function"><span class="keyword">abstract</span> <span class="keyword">void</span> <span class="title">walk</span><span class="params">()</span></span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="28、模板方法的设计模式"><a href="#28、模板方法的设计模式" class="headerlink" title="28、模板方法的设计模式"></a>28、模板方法的设计模式</h3><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study06;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 抽象的应用模板方法</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-01 16:06</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">TemplatesTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        SubTemplate sub = <span class="keyword">new</span> SubTemplate();</span><br><span class="line">        sub.countTime();</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">abstract</span> <span class="class"><span class="keyword">class</span> <span class="title">Template</span></span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">countTime</span><span class="params">()</span></span>&#123;</span><br><span class="line">        <span class="keyword">long</span> start = System.currentTimeMillis();</span><br><span class="line">        code();<span class="comment">//不确定的部分、易变得部分</span></span><br><span class="line">        <span class="keyword">long</span> end = System.currentTimeMillis();</span><br><span class="line">        System.out.println(end-start+<span class="string">"mm"</span>);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">abstract</span> <span class="keyword">void</span> <span class="title">code</span><span class="params">()</span></span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">SubTemplate</span> <span class="keyword">extends</span> <span class="title">Template</span></span>&#123;</span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">code</span><span class="params">()</span></span>&#123;</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; <span class="number">100000</span>; i++) &#123;</span><br><span class="line">            System.out.println(i);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="29、interface接口"><a href="#29、interface接口" class="headerlink" title="29、interface接口"></a>29、interface接口</h3><p>①接口使用interface关键字定义，在java中接口和类是并列结构。</p>
<p>②接口的定义：</p>
<p>​    JDK7.0之前：只能定义全局常量和抽象方法。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> fianl <span class="keyword">int</span> NUM = <span class="number">90</span>;<span class="comment">//全局常量，public static fianl书写时可以省略不写。</span></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">abstract</span> <span class="keyword">void</span> <span class="title">sec</span><span class="params">()</span></span>;<span class="comment">//抽象方法,public abstract书写时可以省略不写</span></span><br></pre></td></tr></table></figure>

<p>​    JDK8.0：除了定义全局常量和抽象方法还能定义静态方法和默认方法</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//接口中还可以定义静态方法和默认方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">interface</span> <span class="title">Compare</span></span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">method</span><span class="params">()</span></span>&#123;&#125;<span class="comment">//静态方法，public可以胜略，但是它还是public的。只能用接口去调用。</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">default</span> <span class="keyword">void</span> <span class="title">method2</span><span class="params">()</span></span>&#123;&#125;<span class="comment">//默认方法，public可以胜略，但是它还是public的。通过实现类的对象可以调用默认方法。如果实现类重写了接口中的默认方法，调用时，调用的是重写后的方法。</span></span><br><span class="line">    <span class="comment">//如果子类（或实现类）继承的父类和实现的接口中声明了同名同参的方法，那么子类在没有重写此方法的情况下，默认调用的是父类中同名同参的方法。如果重写了则调用重写后的方法。--&gt;类优先原则</span></span><br><span class="line">    <span class="comment">//如果实现类实现了多个接口，接口中定义了同名同参的默认方法，那么在没有重写的情况下，报错--&gt;冲突，那么就必须重写，则调用重写后的方法。</span></span><br><span class="line">    <span class="comment">//如何在子类（或实现类）的方法中调用父类或接口中被重写的方法</span></span><br><span class="line">    Compare.supper().method();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>③接口中不能定义构造器，不可以实例化。</p>
<p>④Java开发中让类去实现接口，使用implements关键字来实现，如果实现类覆盖了接口中的所有的抽象方法，此实现类就可以实例化，如果没有全部覆盖，那么此实现类就是抽象类。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study06;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-04 9:22</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">interface</span> <span class="title">InterfaceTest</span> </span>&#123;</span><br><span class="line">    <span class="keyword">int</span> AGE = <span class="number">25</span>;<span class="comment">//省略public static final</span></span><br><span class="line">    <span class="function"><span class="keyword">void</span> <span class="title">song</span><span class="params">()</span></span>;<span class="comment">//省略public abstract</span></span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">Inter</span> <span class="keyword">implements</span> <span class="title">InterfaceTest</span></span>&#123;</span><br><span class="line">    <span class="comment">//常量不可以改变</span></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">song</span><span class="params">()</span></span>&#123;</span><br><span class="line">        System.out.println(<span class="string">"我今年"</span>+AGE+<span class="string">"岁！"</span>+<span class="string">"我喜欢唱歌！"</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">mainTest</span></span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        Inter i = <span class="keyword">new</span> Inter();</span><br><span class="line">        i.song();</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>⑤Java类可以实现多个接口，弥补了Java单继承性的局限性。先写继承父类再写实现接口。</p>
<p>⑥接口和接口之间可以继承，而且可以多继承。</p>
<p>⑦接口的具体使用，体现多态性。</p>
<p>⑧接口实际上可以看做是一种规范。开发中体会面向接口编程。</p>
<p>⑨接口的使用：静态代理模式</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study06;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-04 10:37</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">StaticProxy</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        ChenHeProxy proxy = <span class="keyword">new</span> ChenHeProxy(<span class="keyword">new</span> ChenHe());</span><br><span class="line">        proxy.work();</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//接口定义功能</span></span><br><span class="line"><span class="class"><span class="keyword">interface</span> <span class="title">Star</span></span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">void</span> <span class="title">song</span><span class="params">()</span></span>;</span><br><span class="line">    <span class="function"><span class="keyword">void</span> <span class="title">dance</span><span class="params">()</span></span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//实现功能的真是对象</span></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">ChenHe</span> <span class="keyword">implements</span> <span class="title">Star</span></span>&#123;</span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">song</span><span class="params">()</span></span>&#123;</span><br><span class="line">        System.out.println(<span class="string">"陈赫唱歌！"</span>);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">dance</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        System.out.println(<span class="string">"陈赫跳舞！"</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">//代理对象</span></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">ChenHeProxy</span> <span class="keyword">implements</span> <span class="title">Star</span></span>&#123;</span><br><span class="line">    <span class="keyword">private</span> Star realStar;</span><br><span class="line"></span><br><span class="line">    ChenHeProxy(Star realStar)&#123;</span><br><span class="line">        <span class="keyword">this</span>.realStar = realStar;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">song</span><span class="params">()</span></span>&#123;</span><br><span class="line">        realStar.song();</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">dance</span><span class="params">()</span></span>&#123;</span><br><span class="line">        realStar.dance();</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">work</span><span class="params">()</span></span>&#123;</span><br><span class="line">        System.out.println(<span class="string">"代理人准备舞台！"</span>);</span><br><span class="line">        song();</span><br><span class="line">        dance();</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">//输出</span></span><br><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">	代理人准备舞台！</span></span><br><span class="line"><span class="comment">	陈赫唱歌！</span></span><br><span class="line"><span class="comment">	陈赫跳舞！</span></span><br><span class="line"><span class="comment">*/</span></span><br></pre></td></tr></table></figure>

<h3 id="30、内部类"><a href="#30、内部类" class="headerlink" title="30、内部类"></a>30、内部类</h3><p>①当一个事物的内部，还有一个部分需要一个完整的结构进行描述，而这个内部的完整结构又为外部事物提供服务，那么整个内部的完整结构做好使用内部类。</p>
<p>②Java允许将一个类A声明在另一个类B中，则类A就是内部类，类B就是外部类。</p>
<p>③内部类的分类：成员内部类（静态和非静态）和局部内部类（方法内、代码块内、构造器内）</p>
<p>成员内部类：类内可以定义属性、方法、构造器等；可以被final修饰表示此类不能被继承，不使用final就能被继承；可以被abstract修饰；调用外部类的结构；权限修饰符修饰；static修饰；</p>
<p>④实例化成员内部类的对象：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//静态内部类</span></span><br><span class="line">Person.Dog d = <span class="keyword">new</span> Person.Dog();</span><br><span class="line"><span class="comment">//非静态内部类</span></span><br><span class="line">Person p = <span class="keyword">new</span> Person();</span><br><span class="line">Person.Bird b = p.new Bird()</span><br></pre></td></tr></table></figure>

<p>在局部内部类的方法中，如果调用局部内部类所在的方法中的局部变量，要求次局部变量要声明为final的。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study06;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-06 17:21</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">InerClassTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        Circle.Draw d= <span class="keyword">new</span> Circle.Draw();</span><br><span class="line">        d.drawSahpe();</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">Circle</span> </span>&#123;</span><br><span class="line">    <span class="keyword">double</span> radius = <span class="number">0</span>;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">Circle</span><span class="params">(<span class="keyword">double</span> radius)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.radius = radius;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">static</span> <span class="class"><span class="keyword">class</span> <span class="title">Draw</span> </span>&#123;     <span class="comment">//内部类</span></span><br><span class="line">        <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">drawSahpe</span><span class="params">()</span> </span>&#123;</span><br><span class="line">            System.out.println(<span class="string">"drawshape"</span>);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="31、异常处理"><a href="#31、异常处理" class="headerlink" title="31、异常处理"></a>31、异常处理</h3><p>①Error：Java虚拟机无法解决的严重错误，如：JVM系统内部错误，资源耗尽等严重情况</p>
<p>②Exception:其他因编程错误或偶然的外在因素导致的一般性的问题，可以使用针对性的代码进行处理。例如：空指针、角标越界、文件不存在。。。</p>
<p>​    编译时异常（checked）:FileNotFindException</p>
<p>​    运行时异常（unchecked）:NullPointException</p>
<p>③异常处理</p>
<p>抓抛模型 过程一：程序在正常执行的过程中，一旦出现异常，就会在异常代码处生成一个对应异常类的对象，并将此对象抛出，一旦对象抛出后，其后的代码将不再继续执行。</p>
<p>过程二：异常的处理</p>
<p>try…catch…finally:try后面包含可能会出现异常的代码，可以包含多个catch，针对不同的异常情况进行不同的处理,匹配对应的异常类型后进入到catch内部进行处理，处理后跳出try…catch…结构，继续向下执行。finaliy中的代码最终会被执行，但是不一定要写可选。</p>
<p>catch中的异常类型如果没有子父类关系，则谁声明在上，谁在下无所谓；如果有子父类关系，那么子类一定声明在父类的上面，否则报错。</p>
<p>  使用try-catch-finally处理编译时异常，使得程序在编译时就不报错了，但是运行时仍可能报错。相当于将一个编译时异常推迟到运行时出现。</p>
<p>try-catch-finally结构可以嵌套，finally中声明的是一定会执行的代码，即时catch中又出现了异常，try中有return语句，catch中有return语句等情况。</p>
<p>像数据库连接，输入输出流，网络编程Socket等资源，JVM不会自动的回收，需要我们手动的进行资源的释放，此时的资源释放，就需要声明在finally中。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">e.printStacktTrace();<span class="comment">//异常信息输出至控制台</span></span><br></pre></td></tr></table></figure>

<p>throws:”throws+异常类型”写在方法的声明处，指明此方法在执行时可能会抛出的异常，一旦当方法体执行时，出现异常,仍会在代码处生成一个异常类的对象，此对象满足throws后异常类型时，就会抛出异常，异常代码后续的代码就不再执行。throws的方式只是将异常抛给了方法的调用者，并没有真正处理异常。</p>
<p>子类重写的方法抛出的异常类型不大于父类被重写的方法抛出的异常。</p>
<p>④开发中如何选择：</p>
<p>​    如果父类中被重写的方法没有throws方式处理异常，则子类重写的方法也不能使用throws,意味着如果子类重写的方法有异常，必须使用try-catch-finally进行处理。</p>
<p>​    层级调用的方法，底层结构先throws,顶层结构再try-catch。</p>
<p>⑤throw手动抛出异常：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">throw</span> <span class="keyword">new</span> Exception(<span class="string">"报错了。。。"</span>);</span><br></pre></td></tr></table></figure>

<p>⑥自定义异常类：</p>
<p>​    继承RunTimeException或者Exception；提供serialVersionUID;提供重载的构造器；</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study06;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-06 16:42</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ExceptionTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">int</span> a = <span class="number">10</span>;</span><br><span class="line">        <span class="keyword">int</span> b = <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">try</span>&#123;</span><br><span class="line">            System.out.println(a/b);</span><br><span class="line">        &#125;<span class="keyword">catch</span> (Exception e)&#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125;<span class="keyword">finally</span> &#123;</span><br><span class="line">            System.out.println(<span class="string">"厉害"</span>);</span><br><span class="line">        &#125;</span><br><span class="line">        System.out.println(<span class="string">"就是这么厉害。。"</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study06;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-06 16:45</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">MyExeption</span> <span class="keyword">extends</span> <span class="title">RuntimeException</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="keyword">long</span> serialVersionUID = <span class="number">7575524614027820768L</span>;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">MyExeption</span><span class="params">()</span></span>&#123;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">MyExeption</span><span class="params">(String msg)</span></span>&#123;</span><br><span class="line">        <span class="keyword">super</span>(msg);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="五、Java高级"><a href="#五、Java高级" class="headerlink" title="五、Java高级"></a>五、Java高级</h2><h3 id="1、多线程"><a href="#1、多线程" class="headerlink" title="1、多线程"></a>1、多线程</h3><p>①概念：程序、进行、线程、多核、单核、并行、并发</p>
<p>程序：为完成特定的任务，用某种语言，编写的一组指令的集合。即指一段静态的代码，静态对象。</p>
<p>进程：是程序的一次执行过程，或是正在运行的一个程序。</p>
<p>线程：进程可以进一步细化为线程，是一个程序内部的一条执行路径。若一个进程同时一时间并行执行多个线程，那么这个程序就是多线程的。</p>
<p>单核：只有一个cpu，假的多线程。</p>
<p>多核：多个cpu，更好的发挥多线程的效率。</p>
<p>并行：多个cpu同时执行多个任务、</p>
<p>并发：一个cpu同时执行多个任务、</p>
<p>②多线程的优点</p>
<p>提高应用程序的响应，对图形界面更有意义 ，增强用户体验；提高计算机系统的cpu的利用率；改善程序结构，将既长又复杂的的进程分为多个线程，独立运行，利于理解和修改。</p>
<p>③继承Thread类创建多线程</p>
<p>​    创建一个继承Thread类的子类；</p>
<p>​    重写Thread类的run方法；</p>
<p>​    创建子类对象，调用start()方法；</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study07;</span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-11 14:12</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ThreadTest</span> <span class="keyword">extends</span> <span class="title">Thread</span></span>&#123;</span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">run</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">0</span> ;i&lt;<span class="number">1000</span>;i++)&#123;</span><br><span class="line">            System.out.println(i+Thread.currentThread().getName());</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">Test</span></span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        ThreadTest thread = <span class="keyword">new</span> ThreadTest();</span><br><span class="line">        <span class="comment">//启动当前线程；调用当前线程的run方法</span></span><br><span class="line">        <span class="comment">//不能直接调用run方法起动线程，一个线程只能启动一次。	</span></span><br><span class="line">        thread.start(); </span><br><span class="line">        <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">0</span> ;i&lt;<span class="number">1000</span>;i++)&#123;</span><br><span class="line">            System.out.println(i+Thread.currentThread().getName());</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>④Thread类的常用方法：</p>
<p>start():启动当前线程；调用当前线程的run方法。</p>
<p>run():通常需要重写Thread类的run方法，将创建线程要执行的操作声明在重写的run方法内。</p>
<p>currentThread():静态方法，返回当前的代码的线程。</p>
<p>getName():获取当前线程的名字</p>
<p>setName()：设置当前线程的名字</p>
<p>yield():释放当前cpu的执行权，又有可能抢到执行权—-&gt;礼让</p>
<p>join()：在线程a中调用线程b的join方法，线程a就进入阻塞状态，直到线程b执行结束一会，线程a才会结束阻塞状态。</p>
<p>stop:已过时，结束当前线程</p>
<p>sleep（time）：让当前线程阻塞指定的时间，在这个时间内当前线程是阻塞状态。</p>
<p>isAlive():判断当前线程是否存活</p>
<p>⑤线程的调度</p>
<p>线程的优先等级：</p>
<p>MAX_PRIORITY:10</p>
<p>MIN_PRIORITY:1</p>
<p>NORM_PRIORITY:5 —-&gt;默认优先级</p>
<p>方法：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">thread.getPriority();<span class="comment">//获取当前线程的优先级</span></span><br><span class="line">thread.setPriority();<span class="comment">//设置当前线程的优先级</span></span><br></pre></td></tr></table></figure>

<p> 高优先级的线程要抢占低优先级线程的cpu执行权，但只是从概率上讲，高优先级的线程被执行的概率较高，并不意味着只有当高优先级的线程执行完毕以后，低优先级的线程才开始执行。</p>
<p>⑥实现runable接口创建多线程</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study07;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-11 15:43</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ThreadTest2</span> <span class="keyword">implements</span> <span class="title">Runnable</span> </span>&#123;</span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">run</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; <span class="number">100</span>; i++) &#123;</span><br><span class="line">            <span class="keyword">if</span>(i % <span class="number">2</span> == <span class="number">0</span>)&#123;</span><br><span class="line">                System.out.println(i+<span class="string">"####"</span>);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">Test2</span></span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        ThreadTest2 thread = <span class="keyword">new</span> ThreadTest2();</span><br><span class="line">        Thread t1 = <span class="keyword">new</span> Thread(thread);</span><br><span class="line">        t1.start();</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; <span class="number">100</span>; i++) &#123;</span><br><span class="line">            <span class="keyword">if</span>(i % <span class="number">2</span> == <span class="number">0</span>)&#123;</span><br><span class="line">                System.out.println(i+<span class="string">"----"</span>);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>⑦比较两种创建线程的方式</p>
<p>​    开发中优先使用实现runable接口的方式，实现的方式没有类的单继承性的限制，实现的方式更适合多个线程有共享数据的情况。</p>
<p>​    两种方式都需要重写run方法，将线程需要执行的代码，声明在run方法中。</p>
<p>⑧线程的生命周期</p>
<p>​    新建：当一个Thread类或其子类的对象被声明并创建时，新生的线程处于新建状态。</p>
<p>​    就绪：处于新建状态的线程被start()后，将进入线程队列等待cpu时间片，此时它已具备了运行条件，只是没有分配到cpu资源。</p>
<p>​    运行： 当就绪的线程被调度并获得cpu资源时，便处于运行状态。run()方法定义了线程的操作和功能。</p>
<p>​    阻塞：在某种特殊情况下，被人为的挂起或执行输入输出操作时，让出cpu的并临时中止自己的执行,进入阻塞状态。</p>
<p>​    死亡：当线程完成了它的全部工作或者线程被提前强制性的终止或出现异常导致结束。</p>
<p>⑨线程的安全问题</p>
<p>​    某个线程未完成时，另一个线程也参与进来，就会出现线程的安全问题。</p>
<p>​    如何解决：当一个线程操作共享数据的时候，其他线程不能参与进来；只能等到此线程操作完毕，其他线程才可以操作，即使此线程出现了阻塞也不能被改变。</p>
<p>⑩同步机制解决线程的安全问题</p>
<p>方式一：同步代码块 synchronized(同步监视器){需要被同步的代码}</p>
<p>操作共享数据（多个线程操作的变量）的代码，即为需要被同步的代码。</p>
<p>同步监视器：俗称锁，任何类的对象都可以充当这个锁；多个线程必须公用同一把锁；</p>
<p>在实现runable接口的方式中，可以考虑使用this充当同步监视器。</p>
<p>在继承thread类的方式中，可以使用类.Class对象充当同步监视器。</p>
<p>方法二：同步方法</p>
<p>​    如果操作共享数据的代码，完整的声明在一个方法中，那么不防将此方法声明为同步方法。</p>
<p>​    同步方法任然涉及同步监视器，只是不需要显式的声明。非静态的同步方法，同步监视器是this;静态方法的同步监视器是当前类。</p>
<p>好处：同步的方式解决了线程安全的问题；操作同步代码时，只能有一个线程参与，其他线程等待，相当于一个单线程的过程，效率较低（局限性）。</p>
<p>死锁：不同的线成分别占用对方需要的同步资源不放弃，都在等待对方放弃自己需要的同步资源，就形成了线程的死锁。</p>
<p>​    出现死锁后，不会出现异常，不会出现提示，只是所有的线程都处于阻塞状态，无法继续执行。</p>
<p>​    使用同步锁时避免出现死锁</p>
<p>解决方法：</p>
<p>​    专门的算法、原则；尽量减少同步资源的定义；尽量避免嵌套同步；</p>
<p>JDK5.0后线程的同步：</p>
<p>​    从JDK5.0以后开始，java提供了更强大的线程同步机制，通过显式的定义同步锁对象来实现同步，同步锁使用Lock对象充当。</p>
<p>①创建ReentrantLock对象</p>
<p>②在try…catch…finally结构中，手动加锁lock</p>
<p>③在finally结构中，手动的释放锁unclock.</p>
<p>面试题：synchronized与lock的异同？</p>
<p>相同：二者都可以解决线程安全的问题</p>
<p>不同：synchronized机制在执行完相应的代码以后，自动的释放同步监视器。lock需要手动的启动同步，同时结束时也需要手动的释放锁unlock。</p>
<p>线程的通信：</p>
<p>​    涉及到的三个方法：</p>
<p>​        wait():当前线程进入阻塞状态，并释放同步监视器。</p>
<p>​        notify():唤醒被wait的线程，如果有多个wait的线程，就唤醒优先级高的。</p>
<p>​        notifyAll():唤醒所有被wait的线程</p>
<p>​    三个方法的调用必须使用在同步代码块或者同步方法中；这三个方法的调用者必须是同步代码块或者同步方法中的同步监视器；这三个方法定义在Object类中；</p>
<p>sleep和wait方法的异同：</p>
<p>​    相同：都可以使得当前线程进入阻塞状态</p>
<p>​    不同：声明的位置不一样，sleep声明在thread类中，wait声明在Object类中；sleep可以在任何需要的场景下调用，wait必须在同步代码块或者同步方法中调用；如果两个方法都使用在同步代码块或者同步方法中，sleep不会释放同步监视器，wait会释放同步监视器；</p>
<p>JDK5.0新增的创建多线程的方式：</p>
<p>①实现callable的方式:创建一个实现callable方法的实现类；实现call方法，将此线程需要执行的操作声明早call方法内；创建callable接口实现类的对象；将此callable接口的实现类对象传递到FutrueTask的构造器中，创建FutrueTask的对象；将FutrueTask类的对象，传递到thread类的构造器中，创建Thread类的对象，并调用start()方法。获取call方法的返回值：FutrueTask的对象调用get()方法。</p>
<p>比实现runable接口方式的强大之处：</p>
<p>​    call：有返回值</p>
<p>​    call:可以抛出异常，被外面的操作捕获，获取异常的信息。</p>
<p>​    callable:支持泛型</p>
<p>②线程池的方式：</p>
<p>提前创建好多个线程，放入线程池中，使用时直接获取，使用完放回池中，可以避免频繁创建销毁、实现重复利用。</p>
<p>好处：提高响应速度，减少了创建新线程的时间；</p>
<p>​            降低资源消耗，重复利用线程池中的线程，不需要每次创建；</p>
<p>​            便于管理，可以设置池的大小、最大线程数、等待时间；</p>
<p>API：Executors和ExecutorService</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study07;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.concurrent.ExecutorService;</span><br><span class="line"><span class="keyword">import</span> java.util.concurrent.Executors;</span><br><span class="line"><span class="keyword">import</span> java.util.concurrent.ThreadPoolExecutor;</span><br><span class="line"><span class="keyword">import</span> java.util.concurrent.TimeUnit;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-13 9:08</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ThreadPoolTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        <span class="comment">//创建指定线程数的线程池ExecutorService是接口--&gt;多态</span></span><br><span class="line">        ExecutorService pool = Executors.newFixedThreadPool(<span class="number">10</span>);</span><br><span class="line">        <span class="comment">//获取线程池的实现类，管理线程池，设置相应的属性</span></span><br><span class="line">        ThreadPoolExecutor poolService = (ThreadPoolExecutor) pool;</span><br><span class="line">        poolService.setCorePoolSize(<span class="number">5</span>);</span><br><span class="line">        poolService.setKeepAliveTime(<span class="number">100</span>, TimeUnit.SECONDS);</span><br><span class="line">        MyThread thread = <span class="keyword">new</span> MyThread();</span><br><span class="line">        poolService.execute(thread);</span><br><span class="line">        poolService.execute(thread);</span><br><span class="line">        poolService.shutdown();</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">MyThread</span> <span class="keyword">implements</span> <span class="title">Runnable</span></span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">int</span> ticket = <span class="number">100</span>;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">run</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">while</span>(<span class="keyword">true</span>)&#123;</span><br><span class="line">            <span class="keyword">synchronized</span> (<span class="keyword">this</span>)&#123;</span><br><span class="line">                notify();</span><br><span class="line">                <span class="keyword">if</span>(ticket&gt;<span class="number">0</span>)&#123;</span><br><span class="line">                    System.out.println(Thread.currentThread().getName()+<span class="string">"售票"</span>+ticket);</span><br><span class="line">                    ticket--;</span><br><span class="line">                    <span class="keyword">try</span> &#123;</span><br><span class="line">                        wait();</span><br><span class="line">                    &#125; <span class="keyword">catch</span> (InterruptedException e) &#123;</span><br><span class="line">                        e.printStackTrace();</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;<span class="keyword">else</span>&#123;</span><br><span class="line">                    <span class="keyword">break</span>;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="2、Java常用类"><a href="#2、Java常用类" class="headerlink" title="2、Java常用类"></a>2、Java常用类</h3><h4 id="1、String类"><a href="#1、String类" class="headerlink" title="1、String类"></a>1、String类</h4><p>①String代表字符串，是一个final类，代表不可变的字符序列（当对字符串重新赋值时，需要重新指定内存区域赋值，不能使用原有的value赋值。当对现有的字符串进行连接操作时，也需要重新指定新的内存区域赋值，不能使用原有的value赋值。调用String类的replace的方法，修改字符串时，也是重新指定新的内存区域。）；String对象的字符内容是存储在一个字符数组中；继承了Serializable接口，表示字符串是支持序列化的；实现了Comparable接口，表示string可以比较大小；String内部定义了private final char value[],value用于存储字符串数据；</p>
<p>②通过字面量的方式（区别于new方式）给一个字符串赋值，此时的字符串声明在字符串常量池中，字符串常量池是不会存储相同内容的字符串的；</p>
<p>③String的实例化的方式：</p>
<p>​    字面量的方式：声明在字符串常量池中</p>
<p>​    new + 构造器的方式：在堆空间中创建对象，每new一个都是不同的一个。</p>
<p>常量与常量拼接的结果在常量池，且常量池中不会存在相同内容的常量，只要其中有一个是变量，结果就在堆中，相当于new了一个对象。如果拼接的结果调用intern()方法，返回值就在常量池。</p>
<p>④String类的常用方法：</p>
<pre><code>str.length:返回字符串的长度</code></pre><p>​    str.charAt(int index);返回指定索引处的字符</p>
<p>​    str.isEmpty():判断字符串是否为空，实际判断的是字符串的长度。</p>
<p>​    str.toLowerCase():转换为小写</p>
<p>​    str.toUpCase():转换为大写</p>
<p>​    str.trim():去除字符串前后的一个或多个空格</p>
<p>​    equals():比较字符串的内容是否相同</p>
<p>​    equalsIgnoreCase():忽略大小写比较字符串的内容是否相同</p>
<p>​    concat():将指定字符串拼接到此字符串的末尾，等价于”+”</p>
<p>​    compareTo():比较两个字符串的大小</p>
<p>​    substring(int index):返回新的字符串，是从此字符串的头开始到索引为index的截取。</p>
<p>​    substring(int start,int end):返回索引为start和end之间的子串，左闭右开。</p>
<p>​     endsWith(String suffix):是否以指定的后缀结束。</p>
<p>​    startsWith(String preffix):是否以指定的前缀开始。</p>
<p>​    startsWith(String preffix,int offset):以指定索引开始的子串是否以指定的前缀开始</p>
<p>​    contains(String s):判断此字符串中是否包含指定的字符序列</p>
<p>​    indexOf(String s):返回指定字符串在此字符串中第一次出现处的索引，没有匹配到返回-1。</p>
<p>​    indexof(String s,int index):在此字符串中从指定的索引index开始，返回指定字符串在此字符串中第一次出现处的索引，没有匹配到返回-1。</p>
<p>​    lastIndexOf(String s)、lastIndexOf(String s,int index):从后往前找</p>
<p>​    replace():替换，将指定的字符或者字符串替换成指定的字符或者字符串</p>
<p>​    split(String regex):按照指定的规则分割，返回字符串数组。</p>
<p>⑤String与其他结构的转换</p>
<p>​    String–&gt;基本数据类型、包装类：包装类的静态方法Integer.parseXxx();</p>
<p>​    基本数据类型、包装类–&gt;String:调用String重载的valueOf()方法。</p>
<p>​    String–&gt;char [] :str.tocharArray()返回一个char型数组</p>
<p>​    char [] –&gt;String :调用String类的构造器new String(char);</p>
<p>​    String –&gt; byte [] :str.getBytes()返回一个字节数组,可以指定字符集</p>
<p>​     byte [] –&gt;String:调用String类的构造器new String(char);</p>
<p>⑥Stringbuffer 和 Stringbuilder</p>
<p>​    String、Stringbuffer 和 Stringbuilder的异同？</p>
<p>​    效率：Stringbuilder &gt; Stringbuffer &gt; String</p>
<p>​    String :不可变的字符序列；底层使用char数组存储；默认空参构造器创建地层数组长度为0；</p>
<p>​    Stringbuffer:可变的字符序列；线程安全效率较低；底层使用char数组存储；默认空参构造器创建地层数组长度为16；</p>
<p>​    Stringbuilder：可变的字符序列；JDK5.0新增的，线程不安全效率高；底层使用char数组存储；默认空参构造器创建地层数组长度为16；</p>
<p>当append的字符长度大于了剩余的长度，就会自动扩容，新建一个数组，长度为原来长度的2倍加2，然后将原来的数据复制到新数组中。</p>
<p>StringBuffer与StringBuilder中的常用方法：</p>
<p>​    append():字符串拼接</p>
<p>​    delete():删除指定位置的内容</p>
<p>​    replace():替换</p>
<p>​    insert():在指定位置插入字符串</p>
<p>​     reverse():把当前字符序列逆转</p>
<p>​    indexOf():返回首次出现的索引</p>
<p>​    substring():截取</p>
<p>​    length():长度</p>
<p>​    charAt():返回指定位置的字符</p>
<p>​    setChart():将指定位置的字符修改为新的字符</p>
<h4 id="2、JDK1-8之前时间API"><a href="#2、JDK1-8之前时间API" class="headerlink" title="2、JDK1.8之前时间API"></a>2、JDK1.8之前时间API</h4><p>①    java.lang.System</p>
<p>返回从1970年1月1日0时0分0秒到现在得时间毫秒数，时间戳！</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">System.currentTimeMillis();</span><br></pre></td></tr></table></figure>

<p>②java.util.Date</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study07;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Date;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-13 16:00</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">TimeTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        Date d = <span class="keyword">new</span> Date();</span><br><span class="line">        System.out.println(d.toString());<span class="comment">//Wed Nov 13 16:14:34 CST 2019</span></span><br><span class="line">        System.out.println(d.getTime());<span class="comment">//毫秒数</span></span><br><span class="line"></span><br><span class="line">        Date date = <span class="keyword">new</span> Date(<span class="number">456123354l</span>);</span><br><span class="line">        System.out.println(date.toString());</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>③java.sql.Date</p>
<p>对应数据库中的日期变量的类型</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">java.sql.Date d2 = <span class="keyword">new</span> java.sql.Date(<span class="number">456123354l</span>);</span><br></pre></td></tr></table></figure>

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//java.util.Date 转换为 java.sql.Date</span></span><br><span class="line">java.sql.Date d2 = <span class="keyword">new</span> java.sql.Date(date.getTime());</span><br></pre></td></tr></table></figure>

<p>④SimpleDateFormat</p>
<p>格式化：日期—-&gt;字符串</p>
<p>解析：字符串—-&gt;日期</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">SimpleDateFormat format = <span class="keyword">new</span> SimpleDateFormat(<span class="string">"yyyy-MM-dd hh:mm:ss"</span>);</span><br><span class="line">Date date = <span class="keyword">new</span> Date();</span><br><span class="line">String str = format.format(date);<span class="comment">//格式化</span></span><br><span class="line">System.out.println(str);</span><br><span class="line"><span class="keyword">try</span> &#123;</span><br><span class="line">    format.parse(<span class="string">"2020-11-13 08:52:46"</span>);<span class="comment">//解析</span></span><br><span class="line">&#125; <span class="keyword">catch</span> (ParseException e) &#123;</span><br><span class="line">    e.printStackTrace();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>⑤Calendar日历类</p>
<p>实例化：创建其子类的对象GregorianCalendar；调用其静态方法getInstance();</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">Calendar instance = Calendar.getInstance();</span><br><span class="line">System.out.println(instance.get(Calendar.DAY_OF_MONTH));</span><br><span class="line">instance.set(Calendar.DAY_OF_MONTH,<span class="number">26</span>);</span><br><span class="line">System.out.println(instance.get(Calendar.DAY_OF_MONTH));</span><br><span class="line">System.out.println(instance.getTime());</span><br><span class="line">instance.setTime(<span class="keyword">new</span> Date());</span><br><span class="line"><span class="keyword">int</span> i = instance.get(Calendar.DAY_OF_YEAR);</span><br><span class="line">System.out.println(i);</span><br></pre></td></tr></table></figure>

<h4 id="3、JDK1-8中的时间API"><a href="#3、JDK1-8中的时间API" class="headerlink" title="3、JDK1.8中的时间API"></a>3、JDK1.8中的时间API</h4><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//当前的日期、时间、日期+时间</span></span><br><span class="line">   LocalDate now = LocalDate.now();</span><br><span class="line">   LocalTime now1 = LocalTime.now();</span><br><span class="line">   LocalDateTime now2 = LocalDateTime.now();</span><br><span class="line">   System.out.println(now);</span><br><span class="line">   System.out.println(now1);</span><br><span class="line">   System.out.println(now2);</span><br><span class="line"></span><br><span class="line">   <span class="comment">//指定时间、不需要考虑偏移量</span></span><br><span class="line">   LocalDateTime of = LocalDateTime.of(<span class="number">1992</span>, <span class="number">01</span>, <span class="number">13</span>, <span class="number">13</span>, <span class="number">12</span>, <span class="number">20</span>);</span><br><span class="line">   System.out.println(of);</span><br><span class="line"></span><br><span class="line">   <span class="comment">//获取</span></span><br><span class="line">   System.out.println(now2.getDayOfMonth());<span class="comment">//当月的第几天</span></span><br><span class="line">   System.out.println(now2.getDayOfWeek());</span><br><span class="line"></span><br><span class="line">   <span class="comment">//设置，体现不可变性</span></span><br><span class="line">   LocalDateTime localDateTime = now2.withMonth(<span class="number">12</span>);</span><br><span class="line">   System.out.println(localDateTime);</span><br><span class="line">   System.out.println(now2);</span><br><span class="line"></span><br><span class="line">   <span class="comment">//增加相应数值</span></span><br><span class="line">   LocalDateTime localDateTime1 = now2.plusDays(<span class="number">30</span>);</span><br><span class="line">   System.out.println(localDateTime1);</span><br><span class="line"></span><br><span class="line">   <span class="comment">//减去相应的数值</span></span><br><span class="line">   LocalDateTime localDateTime2 = now2.minusDays(<span class="number">6</span>);</span><br><span class="line">   System.out.println(localDateTime2);</span><br></pre></td></tr></table></figure>

<h4 id="4、instant-瞬时"><a href="#4、instant-瞬时" class="headerlink" title="4、instant 瞬时"></a>4、instant 瞬时</h4><p>时间线上的一个瞬时点</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">Instant now = Instant.now();<span class="comment">//获取本初子午线对应的标准时间</span></span><br><span class="line">      OffsetDateTime offsetDateTime = now.atOffset(ZoneOffset.ofHours(<span class="number">8</span>));<span class="comment">//根据时区，设置偏移量</span></span><br><span class="line">      <span class="keyword">long</span> l = now.toEpochMilli();<span class="comment">//1970.1.1 开始的毫秒数</span></span><br><span class="line">      <span class="keyword">long</span> l1 = offsetDateTime.toEpochSecond();</span><br><span class="line">      System.out.println(offsetDateTime);</span><br><span class="line">      System.out.println(l);</span><br><span class="line">      System.out.println(l1);</span><br><span class="line"></span><br><span class="line">      Instant instant = Instant.ofEpochMilli(<span class="number">46564464542L</span>);</span><br><span class="line">      System.out.println(instant);</span><br></pre></td></tr></table></figure>

<h4 id="5、DateTimeFormatter格式化解析时间日期"><a href="#5、DateTimeFormatter格式化解析时间日期" class="headerlink" title="5、DateTimeFormatter格式化解析时间日期"></a>5、DateTimeFormatter格式化解析时间日期</h4><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">DateTimeFormatter formatter = DateTimeFormatter.ofPattern(<span class="string">"yyyy-MM-dd hh:mm:ss"</span>);</span><br><span class="line">String format = formatter.format(LocalDateTime.now());</span><br><span class="line">System.out.println(format);</span><br><span class="line"></span><br><span class="line">TemporalAccessor parse = formatter.parse(<span class="string">"2019-11-13 10:28:40"</span>);</span><br><span class="line">System.out.println(parse);</span><br></pre></td></tr></table></figure>

<h4 id="6、Java比较器"><a href="#6、Java比较器" class="headerlink" title="6、Java比较器"></a>6、Java比较器</h4><p>​    java中的对象，正常情况下只能进行==或!=的比较，在实际开发场景中，我们需要对多个对象进行排序，从而比较大小。两个接口Comparable和Comparator。</p>
<p>①Comparable接口 –自然排序</p>
<p>​    例如String、包装类等实现了Comparable接口，重写了 compareTo(obj)方法，给出了比较两个对象大小的方式，从小到大排列。</p>
<p>​    对于自定义类，让自定义类实现Comparable接口，重写comparTo方法，在方法中指明如何排序。</p>
<p>重写compareTo(obj)方法的规则：</p>
<p>​    如果当前对象this大于形参对象obj，则返回正整数。</p>
<p>​    如果当前对象this小于形参对象obj，则返回负整数。</p>
<p>​    如果当前对象this等于形参对象obj，则返回零。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study07;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.junit.Test;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Arrays;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-14 9:11</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ComparableTest</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Test</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">test1</span><span class="params">()</span></span>&#123;</span><br><span class="line">        Goods [] arr = <span class="keyword">new</span> Goods [<span class="number">5</span>];</span><br><span class="line">        arr[<span class="number">0</span>] = <span class="keyword">new</span> Goods(<span class="string">"牛奶"</span>,<span class="number">5</span>);</span><br><span class="line">        arr[<span class="number">1</span>] = <span class="keyword">new</span> Goods(<span class="string">"雪糕"</span>,<span class="number">2</span>);</span><br><span class="line">        arr[<span class="number">2</span>] = <span class="keyword">new</span> Goods(<span class="string">"可乐"</span>,<span class="number">3</span>);</span><br><span class="line">        arr[<span class="number">3</span>] = <span class="keyword">new</span> Goods(<span class="string">"鸡肉"</span>,<span class="number">25</span>);</span><br><span class="line">        arr[<span class="number">4</span>] = <span class="keyword">new</span> Goods(<span class="string">"猪肉"</span>,<span class="number">50</span>);</span><br><span class="line"></span><br><span class="line">        Arrays.sort(arr);</span><br><span class="line">        System.out.println(Arrays.toString(arr));</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">Goods</span> <span class="keyword">implements</span> <span class="title">Comparable</span></span>&#123;</span><br><span class="line">    <span class="keyword">private</span> String name;</span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">int</span> price;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">Goods</span><span class="params">(String name, <span class="keyword">int</span> price)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.name = name;</span><br><span class="line">        <span class="keyword">this</span>.price = price;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getName</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> name;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setName</span><span class="params">(String name)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.name = name;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">getPrice</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> price;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setPrice</span><span class="params">(<span class="keyword">int</span> price)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.price = price;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">compareTo</span><span class="params">(Object o)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">if</span>(o <span class="keyword">instanceof</span> Goods)&#123;</span><br><span class="line">            Goods g = (Goods)o;</span><br><span class="line">            <span class="keyword">if</span>(<span class="keyword">this</span>.price &gt; g.price)&#123;</span><br><span class="line">                <span class="keyword">return</span> <span class="number">1</span>;</span><br><span class="line">            &#125;<span class="keyword">else</span> <span class="keyword">if</span>(<span class="keyword">this</span>.price &lt; g.price)&#123;</span><br><span class="line">                <span class="keyword">return</span> -<span class="number">1</span>;</span><br><span class="line">            &#125;<span class="keyword">else</span>&#123;</span><br><span class="line">                <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="comment">//return Integer.compare(this.price ,g.price);包装类比较大小的方法</span></span><br><span class="line">        <span class="keyword">throw</span> <span class="keyword">new</span> RuntimeException(<span class="string">"传入的类型不一致，无法比较!"</span>);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">toString</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> <span class="string">"Goods&#123;"</span> +</span><br><span class="line">                <span class="string">"name='"</span> + name + <span class="string">'\''</span> +</span><br><span class="line">                <span class="string">", price="</span> + price +</span><br><span class="line">                <span class="string">'&#125;'</span>;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>②Comparator接口–定制排序</p>
<p>​    当元素的类型某一实现java.lang.Compareable接口，而又不方便修改代码；或者实现了Compareable接口的排序规则不适合当前的操作，那么可以考虑使用Comparator来进行操作。</p>
<p>​    重写compare（Object o1,Object o2）方法，比较o1和o2的大小：</p>
<p>​        如果返回正正数，则o1大于o2</p>
<p>​        如果返回0，则o1等于o2</p>
<p>​        如果返回负正数，则o1小于o2</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study07;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.junit.Test;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Arrays;</span><br><span class="line"><span class="keyword">import</span> java.util.Comparator;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-14 9:51</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">CompartorTest</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Test</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">test</span><span class="params">()</span></span>&#123;</span><br><span class="line">        Car [] cars = <span class="keyword">new</span> Car[<span class="number">3</span>];</span><br><span class="line">        cars[<span class="number">0</span>] = <span class="keyword">new</span> Car(<span class="string">"手扶拖拉机"</span>,<span class="number">4</span>);</span><br><span class="line">        cars[<span class="number">1</span>] = <span class="keyword">new</span> Car(<span class="string">"奔奔"</span>,<span class="number">3</span>);</span><br><span class="line">        cars[<span class="number">2</span>] = <span class="keyword">new</span> Car(<span class="string">"摩托车"</span>,<span class="number">2</span>);</span><br><span class="line"></span><br><span class="line">        <span class="comment">//Arrays.sort(cars);</span></span><br><span class="line">        Arrays.sort(cars, <span class="keyword">new</span> Comparator&lt;Car&gt;() &#123;</span><br><span class="line">            <span class="meta">@Override</span></span><br><span class="line">            <span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">compare</span><span class="params">(Car o1, Car o2)</span> </span>&#123;</span><br><span class="line">               <span class="keyword">return</span> o1.getName().compareTo(o2.getName());</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;);</span><br><span class="line">        System.out.println(Arrays.toString(cars));</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">Car</span> <span class="keyword">implements</span> <span class="title">Comparable</span></span>&#123;</span><br><span class="line">    <span class="keyword">private</span> String name;</span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">int</span> count;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">Car</span><span class="params">(String name, <span class="keyword">int</span> count)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.name = name;</span><br><span class="line">        <span class="keyword">this</span>.count = count;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getName</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> name;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setName</span><span class="params">(String name)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.name = name;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">getCount</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> count;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setCount</span><span class="params">(<span class="keyword">int</span> count)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.count = count;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">toString</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> <span class="string">"Car&#123;"</span> +</span><br><span class="line">                <span class="string">"name='"</span> + name + <span class="string">'\''</span> +</span><br><span class="line">                <span class="string">", count="</span> + count +</span><br><span class="line">                <span class="string">'&#125;'</span>;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">compareTo</span><span class="params">(Object o)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">if</span>(o <span class="keyword">instanceof</span>  Car)&#123;</span><br><span class="line">            Car c = (Car)o;</span><br><span class="line">            <span class="keyword">return</span> Integer.compare(<span class="keyword">this</span>.count,c.count);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">throw</span> <span class="keyword">new</span> RuntimeException(<span class="string">"类型不一致"</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="7、System、Math、BigInteger、BigDecimal"><a href="#7、System、Math、BigInteger、BigDecimal" class="headerlink" title="7、System、Math、BigInteger、BigDecimal"></a>7、System、Math、BigInteger、BigDecimal</h4><p>①System</p>
<p>​    代表系统，系统级的很多属性和控制方法都放置在改类内部。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">long</span> l = System.currentTimeMillis();<span class="comment">//时间</span></span><br><span class="line">String property = System.getProperty(<span class="string">"java.version"</span>);<span class="comment">//获取系统属性</span></span><br><span class="line">System.gc();<span class="comment">//通知垃圾回收机制回收</span></span><br><span class="line">System.exit(<span class="number">0</span>);<span class="comment">//系统退出</span></span><br></pre></td></tr></table></figure>

<p>②Math</p>
<p>数学操作相关</p>
<p>③BigInteger</p>
<p>不可变得任意精度的整数</p>
<p>④BigDecimal</p>
<p>在商业计算中，要求数字精度更高。支持不可变的任意精度的有符号十进制定点数。</p>
<h3 id="3、枚举类"><a href="#3、枚举类" class="headerlink" title="3、枚举类"></a>3、枚举类</h3><p>①类的对象只有有限个，确定的；当需要定义一组常量时，强烈建议使用枚举类。</p>
<p>②自定义枚举类</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study07;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.junit.Test;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-14 11:21</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">MyEnumTest</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Test</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">test</span><span class="params">()</span></span>&#123;</span><br><span class="line">        Week ewe = Week.EWE;</span><br><span class="line">        System.out.println(ewe.getName());</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">Week</span></span>&#123;</span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">final</span> String name;</span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">final</span> String desc;</span><br><span class="line">	</span><br><span class="line">    <span class="comment">//私有化类的构造器并给属性赋值</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">Week</span><span class="params">(String name, String desc)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.name = name;</span><br><span class="line">        <span class="keyword">this</span>.desc = desc;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> Week MOD = <span class="keyword">new</span> Week(<span class="string">"星期一"</span>,<span class="string">"好好上班"</span>);</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> Week EWE = <span class="keyword">new</span> Week(<span class="string">"星期二"</span>,<span class="string">"好好学习"</span>);</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getName</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> name;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getDesc</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> desc;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">toString</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> <span class="string">"Week&#123;"</span> +</span><br><span class="line">                <span class="string">"name='"</span> + name + <span class="string">'\''</span> +</span><br><span class="line">                <span class="string">", desc='"</span> + desc + <span class="string">'\''</span> +</span><br><span class="line">                <span class="string">'&#125;'</span>;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>③使用enum关键字</p>
<p>定义的枚举类默认继承与java.lang.Enum类；枚举类的多个对象之间用逗号分隔，末尾用分号结束。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study07;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.junit.Test;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-14 11:21</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">MyEnumTest</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Test</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">test</span><span class="params">()</span></span>&#123;</span><br><span class="line">        Week ewe = Week.EWE;</span><br><span class="line">        System.out.println(ewe.getName());</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">enum</span>  Week&#123;</span><br><span class="line"></span><br><span class="line">    MOD(<span class="string">"星期一"</span>,<span class="string">"好好上班"</span>),</span><br><span class="line">    EWE(<span class="string">"星期二"</span>,<span class="string">"好好学习"</span>);</span><br><span class="line"></span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">final</span> String name;</span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">final</span> String desc;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">private</span> <span class="title">Week</span><span class="params">(String name, String desc)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.name = name;</span><br><span class="line">        <span class="keyword">this</span>.desc = desc;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getName</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> name;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getDesc</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> desc;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">toString</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> <span class="string">"Week&#123;"</span> +</span><br><span class="line">                <span class="string">"name='"</span> + name + <span class="string">'\''</span> +</span><br><span class="line">                <span class="string">", desc='"</span> + desc + <span class="string">'\''</span> +</span><br><span class="line">                <span class="string">'&#125;'</span>;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>④Enum类中的常用方法</p>
<p>values():返回枚举类型的对象数组</p>
<p>valueof(String str):返回名为str的枚举对象</p>
<p>toString():返回当前枚举对象的常量名称</p>
<p>⑤使用enum关键字定义的枚举类实现接口的情况</p>
<pre><code>情况一：实现接口，在枚举类中实现抽象方法。</code></pre><p>​     情况一:让枚举类的对象分别实现接口中的抽象方法。</p>
<h3 id="4、注解（Annotation-JDK5-0）"><a href="#4、注解（Annotation-JDK5-0）" class="headerlink" title="4、注解（Annotation JDK5.0）"></a>4、注解（Annotation JDK5.0）</h3><p>​    Annotation其实就是代码里的特殊标记，这些标记可以在编译，类加载，运行时被读取，并执行相应的处理。可用于修饰包、类、构造器、方法、成员变量、参数、局部变量的声明，这些信息被保存在Annotation的name=value对中。通过使用注解，程序员可以在不改变原有逻辑的情况下，在源文件中嵌入一些补充信息。    </p>
<p>​    ①JDK中提供的三个基本注解（编译时校验）</p>
<p>​    override：限定重写父类或者接口中的方法</p>
<p>​    deprecated:表示修饰的类、方法已过时</p>
<p>​    supperssWarnings:抑制编译器警告</p>
<p>​    ②自定义注解</p>
<p>​    注解声明为@interface;内部定义成员，通常使用value表示；可以指定成员的默认值，使用default定义；如果自定义注解没有成员，表明是以个标识作用；如果注解有成员，在使用注解时，需要指明成员的值；</p>
<p>​    ③JDK中的元注解</p>
<p>​    用于修饰注解的注解</p>
<p>​    Retention:指定所修饰的注解的生命周期。SOURCE/CLASS(默认行为)/RUNTIME</p>
<p>​        只有声明为RUNTIME生命周期的注解，才能通过反射获取。</p>
<p>​    Target:用于指定被修饰的注解能用于修饰那些元素</p>
<p>​    Documented:表示所修饰的注解，被javadoc解析是保留下来。</p>
<p>​    Inherited:被它修饰的注解具有继承性</p>
<p>④JDK8 注解的新特性</p>
<p>​    可重复注解：@Repeatable(MyAnnotations.class),Target/Retention/Inherited一致</p>
<p>​    类型注解：ElementType.TYPE_PARAMETER表示该注解能写在类型变量的声明语句中</p>
<p>​    ElementType.TYPE_USE表示该注解能写在使用类型的任何语句中</p>
<h3 id="5、集合"><a href="#5、集合" class="headerlink" title="5、集合"></a>5、集合</h3><p>①集合框架的概述</p>
<p>​    集合、数组都是对多个数据进行存储操作的结构，简称Java容器（此时的存储的值指的是内存层面的存储，不涉及到持久化的存储。）；</p>
<p>​    数组在存储数据时的特点：初始化后长度确定；一旦定义好其元素的类型也就确定了；</p>
<p>​    数组在存储数据时的缺点：数据的长度不能修改；数组中提供的方法非常有限，对于添加、删除、插入等操作，非常的不便，效率也不高 ；获取数组中实际元素的个数的需求，数组没有现成的属性或者方法可用。数组存储数据有序、可以重复，对于无序不可重复的需求不能满足。</p>
<p>②集合框架</p>
<p>-Collection接口：单列集合，用来存储一个一个的对象。</p>
<p>​    –List接口：存储有序的、可重复的数据。”动态数组” </p>
<p>​        –ArrayList     –LinkedLsit    –Vector</p>
<p>​    –Set接口：存储无序的、不可重复的数据。”数学中的集合”</p>
<p>​        –HashSet    –LinkedHashSet    –TreeSet</p>
<p>-Map接口：双列集合，用来存储一对（key-value）一对的数据。”数学中的函数 y = f(x)”</p>
<p>​    –HashMap    –LinkedHashMap:    –TreeMap:    –HashTable:    –Properties:</p>
<p>③Collection接口中的方法：</p>
<p>​    add():添加元素；size():元素的个数； addAll():将一个集合中的元素添加到另一个集合中；isEmpty():判断当前是否为空；clean():清空集合；contains():判断集合中是否包含元素；containsAll():判断集合中的元素是否全部包含在当前集合中；remove():移除某个元素；removeAll():集合中移除另一个集合中的全部元素；rerainAll():返回两个集合的交集；hashCode():返回集合的哈希值；toArray():集合转为数组；Arrays.asList():数组转集合；Iterator():返回遍历集合的迭代器。</p>
<p>结论：向Collecton接口的实现类的对象添加数据obj时,要求obj所在类要重写equals()方法</p>
<p>④集合元素的遍历</p>
<p>​    Iterator仅用于集合，集合对象每次调用Iterator()方法都得到一个全新的迭代器对象，默认游标都在集合的第一个元素之前。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">test</span><span class="params">()</span></span>&#123;</span><br><span class="line">        Collection col = <span class="keyword">new</span> ArrayList();</span><br><span class="line">        col.add(<span class="number">123</span>);</span><br><span class="line">        col.add(<span class="string">"456"</span>);</span><br><span class="line">        col.add(<span class="keyword">new</span> Date());</span><br><span class="line">		<span class="comment">//迭代</span></span><br><span class="line">        Iterator iterator = col.iterator();</span><br><span class="line">        <span class="keyword">while</span> (iterator.hasNext())&#123;<span class="comment">//判断是否有下一个元素</span></span><br><span class="line">            Object next = iterator.next();<span class="comment">//指针下移并返回指针对应的元素</span></span><br><span class="line">            <span class="keyword">if</span>(<span class="string">"456"</span>.equals(next))&#123;</span><br><span class="line">                iterator.remove();<span class="comment">//移除元素</span></span><br><span class="line">            &#125;</span><br><span class="line">            System.out.println(next);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br></pre></td></tr></table></figure>

<p>​    如果还未调用next()或在上次调用next()方法之后已经调用了remove方法，再调用remove都会报IllegalStateException。</p>
<p>for-each遍历：内部仍然调用迭代器，jdk 5.0新增，用于遍历集合和数组。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">Collection col = <span class="keyword">new</span> ArrayList();</span><br><span class="line">   col.add(<span class="number">123</span>);</span><br><span class="line">   col.add(<span class="string">"456"</span>);</span><br><span class="line">   col.add(<span class="keyword">new</span> Date());</span><br><span class="line"></span><br><span class="line">   <span class="keyword">for</span>(Object obj : col)&#123;</span><br><span class="line">       System.out.println(obj);</span><br><span class="line">   &#125;</span><br></pre></td></tr></table></figure>

<p>⑤List接口</p>
<p>​    ArrayList、LinkedLsit、Vector三者的异同？</p>
<p>​    同：都实现类List接口，存储数据的特点相同：存储有序的、可重复的数据。</p>
<p>​    不同：     ArrayList:线程不安全、效率高；底层使用Object类型的数组；</p>
<p>​                    LinkedLsit:底层使用双向链表；对于频繁的插入、删除操作使用比ArrayList效率高；</p>
<p>​                    Vector:线程安全、效率高；底层使用Object类型的数组；</p>
<p>​    ArrayList源码分析：</p>
<p>​        JDK7.0的版本：</p>
<p>​            ArrayList list = new ArrayList():底层创建了一个长度为10的Object [] 数组；建议使用带参的构造器，                避免重复的扩容，提升效率。</p>
<p>​            list.add():如果此次的添加导致底层数组长度不够，就默认扩容为原来数组的1.5倍，同时需要将原有                数组中的数据复制到新数组。</p>
<p>​        JDK8.0的版本：</p>
<p>​            ArrayList list = new ArrayList():底层数组初始化为{}，并没有创建长度为10的数组。</p>
<p>​            list.add():第一次调用添加操作，底层才创建长度为10的数组，并将数据添加到容器中。后续的扩容与                jdk7.0中一致。</p>
<p>​        总结：jdk7中的ArrayList的对象创建类似于单例的饿汉式，jdk8中的ArrayList的对象创建类似于单例的懒汉式，延迟了数组的创建，节省了内存。</p>
<p>​    LinkedLsit源码分析：</p>
<p>​        LinkedList&lt;&gt; list = new LinkedList&lt;&gt;(); 内部声明了Node类型的first和last的属性，默认值为null;</p>
<p>​        list.add();将元素封装到Node中，创建了Node对象。</p>
<p>​        node的定义体现了双向链表的说法。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">linkLast</span><span class="params">(E e)</span> </span>&#123;</span><br><span class="line">       <span class="keyword">final</span> Node&lt;E&gt; l = last;</span><br><span class="line">       <span class="keyword">final</span> Node&lt;E&gt; newNode = <span class="keyword">new</span> Node&lt;&gt;(l, e, <span class="keyword">null</span>);</span><br><span class="line">       last = newNode;</span><br><span class="line">       <span class="keyword">if</span> (l == <span class="keyword">null</span>)</span><br><span class="line">           first = newNode;</span><br><span class="line">       <span class="keyword">else</span></span><br><span class="line">           l.next = newNode;</span><br><span class="line">       size++;</span><br><span class="line">       modCount++;</span><br><span class="line">   &#125;</span><br></pre></td></tr></table></figure>

<p>​    Vector源码分析：通过构造器创建对象时，底层都创建了长度为10的数组，在扩容时，默认扩容长度为原来的2倍。</p>
<p>​    常用方法：indexOf():返回指定元素第一次出现的索引</p>
<p>​                    lastIndexOf():返回指定元素最后一次出现的索引</p>
<p>​                    sublist()：返回start和end之间的子集，左闭右开。</p>
<p>​    list的遍历总结：迭代器；增强for;普通for(list.get(i));</p>
<p>​    list中的remove(int index)和remove(Object o)注意区分；</p>
<p>⑥Set接口(无序的、不可重复)</p>
<p>​    HashSet：线程不安全，可以存储null;底层数组加链表的结构；</p>
<p>​    LinkedHashSet：作为HashSet的子类，遍历其内部数据时，可以按照添加的顺序遍历。在添加数据的同时还维护了两个引用，记录此数据前一个数据和后一个数据，对于比较频繁的遍历操作，效率高于HashSet。</p>
<p>​    TreeSet：可以按照添加对象的指定属性进行排序；存放同一类型的数据。</p>
<p>​    无序的、不可重复的理解（以HashSet为例）：</p>
<p>​        set接口没有额外定义新的方法，全部使用Collection接口中的方法。</p>
<p>​        无序性不等于随机性，存储的数据在底层数组中并非按照数组索引的顺序添加，而是根据数据的hash    值。不可重复性保证添加的元素按照equals方法判断时，不能返回true，即相同的元素只能添加一个。</p>
<p>​        添加过程（数组+链表）：向HashSet中添加元素a，首先调用a所在类的hashCode()方法，计算a的哈希值，此哈希值接着通过某种算法计算出在HashSet底层数组中的存放位置（索引位置），判断数组此位置上是否已经有元素：</p>
<p>​    如果此位置上没有元素，则元素a添加成功；</p>
<p>​    如果此位置上有其他的元素b(或以链表形式存在多个元素)，则比较元素a与元素b的hash值：</p>
<p>​            如果哈希值不相同，则元素a添加成功；</p>
<p>​            如果哈希值相同，进而需要调用元素a所在类的equals()方法：</p>
<p>​                    如果equals返回true,则元素a添加失败；</p>
<p>​                    如果equals返回false,则元素a添加成功；</p>
<p>​    要求：向Set中添加的数据，其所在的类一定要重写hashCode和equals方法，重写的方法尽可能保持一致性，相同的对象具有相同的哈希值。重写技巧：两个方法使用相同的字段。</p>
<p>TreeSet：</p>
<p>​    向TreeSet中添加的数据，要求是同一类的对象；</p>
<p>​    两种排序：自然排序（Comparable）和定制排序（Comparator）。自然排序中比较两个对象是否相同的标准为：compareTo返回0，而不是equals方法。定制排序中比较两个对象是否相同的标准为：compare返回0，而不是equals方法。</p>
<p>⑦Map接口（双列数据，存储key-value数据）</p>
<p>​    –HashMap：线程不安全，效率高；可以存储null的key和value;底层结构：7 数组+链表  8 数组+链表+红黑树</p>
<p>​        –LinkedHashMap:保证在遍历map元素时，可以按照添加的顺序实现遍历。原因：在原有的HashMap底层结构基础上，添加了一对指针，指向前一个和后一个，对于频繁的遍历操作，此类执行的效率高于HashMap。</p>
<p>​    –TreeMap:保证按照添加的key-value对进行排序，实现按key排序遍历，要求key必须是同一个类创建的对象；底层使用红黑树。排序：自然排序、定制排序</p>
<p>​    –HashTable:线程安全，效率低；不可以存储null的key和value；</p>
<p>​        –Properties:常用来处理配置文件，key和value都是String类型；</p>
<p>Map结构的理解：</p>
<p>​    Map中的key：无序的、不可重复的，使用Set存储所有的key，key所在的类要重写equals和HashCode方法（HashMap为例）；</p>
<p>​    Map中的value：无序的、可重复的，使用Collection存储所有的value；value所在的类要重写equals方法；</p>
<p>​    一个键值对：key-value构成了一个Entry对象；map中的Entry：无序、不可重复，使用set存储所有的entry;</p>
<p>HashMap底层实现原理（jdk 7）：</p>
<p>​    HashMap map =  new HashMap();在实例化以后，底层创建了长度是16的一维数组Entry [] table</p>
<p>​    map.put(key,value);首先调用key所在类的hashcode方法计算key的哈希值，此哈希值经过某种算法，得到Entry数组中的位置 ，如果此位置上的数据为空，此时添加成功；如果此位置上的数据不为空（此位置存在一个或者多个数据），比较key和已经存在的数据的哈希值，如果哈希值都不相同，此时添加成功；如果哈希值和已经存在的某个key的哈希值相同，此时调用key所在类的equals方法比较，如果返回false，此时添加成功，返回true，使用value替换存在的key对应的value。</p>
<p>​    在添加过程中会涉及扩容问题，扩容为原来容量的2倍，并将原有的数据复制过来。</p>
<p>jdk8相较与jdk7底层实现方面的不同：</p>
<p>​    new HashMap():底层没有创建一个长度为16的数组；jdk8底层的数组是Node不是Entry；首次调用put方法时，底层创建长度为16的数组；jdk7 数组+链表，jdk8 数组+链表+红黑树，当数组的某一个索引位置上的元素以链表形式存在的数据个数大于8且当前数组的长度大于64时，此时此索引位置上的所有数据改为红黑树存储。</p>
<p>LinkedHashMap底层（了解），每个node存储前一个和后一个的指针；</p>
<p>map接口中定义的方法：</p>
<p>​    put():添加；putAll():添加全部；remove():移除指定key的key-value对，并返回value;clear():清空当前map中的所有数据；get():根据key获取对应的value;containsKey():是否包含指定的key；containsValue():是否包含指定的value；size():返回map中的key-value对数；isEmpty():判断当前map是否为空；equals():判断当前map和参数对象是否相等；</p>
<p>map的遍历：</p>
<p>​    keySet():返回key构成的set集合</p>
<p>​    values():返回所有value构成的Collection集合</p>
<p>​    entrySet():返回key-value对构成的set集合</p>
<p>properties使用：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">Properties pro = <span class="keyword">new</span> Properties();</span><br><span class="line">FileInputStream ins = <span class="keyword">null</span>;</span><br><span class="line"><span class="keyword">try</span> &#123;</span><br><span class="line">    ins = <span class="keyword">new</span> FileInputStream(<span class="string">"jdbc.properties"</span>);</span><br><span class="line">    pro.load(ins);</span><br><span class="line">&#125; <span class="keyword">catch</span> (java.io.IOException e) &#123;</span><br><span class="line">    e.printStackTrace();</span><br><span class="line">&#125;</span><br><span class="line">String name = pro.getProperty(<span class="string">"name"</span>);</span><br><span class="line">System.out.println(name);</span><br></pre></td></tr></table></figure>

<p>⑧Collections工具类</p>
<p>​    操作Collection、map的工具类</p>
<p>​    面试题：Collection和Collections的区别？</p>
<p>​    常用方法：reverse(list):反转list中元素的顺序；sort():根据元素的自然顺序按升序排序；sort(list,comparator)：根据指定的规则对list进行排序；swap(list,i,j):交换i和j索引对应的元素； max():按自然顺序或者指定的规则，返回集合中最大的元素；min():按自然顺序或者指定的规则，返回集合中最小的元素；copy(List l,List k):将k中的内容复制到l中；synchronizedXXX():将指定集合包装成线程同步的集合，从而解决多线程并发访问集合时的线程安全问题；</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Test</span></span><br><span class="line">   <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">test2</span><span class="params">()</span></span>&#123;</span><br><span class="line">       List list = <span class="keyword">new</span> ArrayList();</span><br><span class="line">       list.add(<span class="string">"123"</span>);</span><br><span class="line">       list.add(<span class="string">"456"</span>);</span><br><span class="line">       list.add(<span class="string">"789"</span>);</span><br><span class="line"></span><br><span class="line">       System.out.println(list);</span><br><span class="line"></span><br><span class="line">       List&lt;Object&gt; des = Arrays.asList(<span class="keyword">new</span> Object[list.size()]);</span><br><span class="line">       System.out.println(des);</span><br><span class="line">       Collections.copy(des,list);</span><br><span class="line">       System.out.println(des);</span><br><span class="line">   &#125;</span><br></pre></td></tr></table></figure>

<h3 id="6、泛型（JDK5-0）"><a href="#6、泛型（JDK5-0）" class="headerlink" title="6、泛型（JDK5.0）"></a>6、泛型（JDK5.0）</h3><p>什么是泛型：</p>
<p>​    标签—-&gt;就是允许在定义类、接口时通过一个标识表示类中某个属性的类型或者某个方法的返回值及参数类型。泛型是一个类，不能使用基本数据类型，可以使用基本数据类型的包装类。如果实例化时没有指定泛型的类型，默认为Object类型。</p>
<p>​    编译时就会进行类型检查，保证数据的安全。避免了类型的判断和强转操作。</p>
<p>自定义泛型结构：</p>
<p>​    泛型类、泛型接口：在类名后面使用一对<e>来表示这是一个泛型类，在类的内部结构中，可以使用E类型。继承时，如果泛型父类没有指定泛型的类型，那么子类也成了泛型类，如果父类指定了泛型的类型，那么子类也就确定了类型，不在需要声明泛型。</e></p>
<p>​    泛型类可能有多个参数，将多个参数一起放在一对&lt;&gt;内，用逗号分隔；泛型类的构造器不能使用泛型；泛型不同的引用不能相互赋值；如果泛型结构是一个接口或抽象类，则不可创建泛型类的对象；在类和接口中声明泛型时，不能在静态方法中使用泛型；异常类不是泛型的；不能使用T [] t = new T [10]，但是可以 T [] t = (T []) new Object [10];</p>
<p>​    泛型方法：在方法中出现了泛型的结构 ，泛型参数与类的泛型参数没有任何关系。泛型方法所属的类是不是泛型类都没有关系。 泛型方法可以声明为静态的，原因：泛型参数是在调用方法时确定的，并非在实例化类时确定的。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> &lt;E&gt; <span class="function">List&lt;E&gt; <span class="title">toList</span><span class="params">(E e)</span></span>&#123;</span><br><span class="line">       <span class="keyword">return</span> <span class="keyword">new</span> ArrayList&lt;E&gt;();</span><br><span class="line">   &#125;</span><br></pre></td></tr></table></figure>

<p>泛型类的使用场景：</p>
<p>​    封装一些工具类时，由于不确定一些类型，所有使用泛型。在实例化时或者继承时指明泛型的类型。</p>
<p>泛型在继承方面的体现：</p>
<p>​    类A是类B的父类，G<a>和G<b>二者不具备子父类关系，二者是并列关系。</b></a></p>
<p>​    泛型不同的引用不能相互赋值。</p>
<p>通配符的使用：</p>
<p>​    通配符 ?  匹配任意类型</p>
<p>​    G<a>和G<b>二者不具备子父类关系，二者是并列关系，二者共同的父类&lt;?&gt;</b></a></p>
<p>​    对于List&lt;?&gt; 就不能向其内部添加数据，除了null；允许读取数据，读取的数据类型为Object类型的；</p>
<p>有限制条件的通配符的使用：</p>
<p>​    ？ extends A: G&lt;? extends A&gt;可以作为G<a>和G<b>的父类，其中B是A的子类。</b></a></p>
<p>​    ? supper A: G&lt;? supper A&gt;可以作为G<a>和G<b>的父类，其中B是A的父类。</b></a></p>
<h3 id="7、IO流"><a href="#7、IO流" class="headerlink" title="7、IO流"></a>7、IO流</h3><p>①File类的使用</p>
<p>​    File类的一个对象，代表一个文件或一个文件夹（目录）；</p>
<p>​    File类声明在java.io包下；</p>
<p>​    创建File类的实例：</p>
<p>​        File(String path);</p>
<p>​        File(String parentPath,String childPath);</p>
<p>​        File(File parrntFile,String childPath);</p>
<p>​    相对路径：相较与某个路径下，指明的路径。</p>
<p>​    绝对路径：包含盘符在内的文件或者文件目录路径。</p>
<p>​    文件路径分割符： String separator = File.separator;根据操作系统，动态的提供分隔符。</p>
<p>②File类的常用方法</p>
<p>​    lastModiFied():获取最后一次的修改时间，毫秒值</p>
<p>​    listFiles():获取指定目录下的所有文件或者文件目录的File数组</p>
<p>​    renameTo(File dest):把文件重命名为指定的文件路径，file1.renameTo(file2)为例说明：要想保证返回true，需要file1在硬盘中是存在的，且file2不能在硬盘中存在。</p>
<p>​    isDirectory():判断是否是文件目录</p>
<p>​    isFile():判断文件是否是文件</p>
<p>​    exists():判断是否存在</p>
<p>​    canRead():判断是否可读</p>
<p>​    isHidden():判断是否隐藏</p>
<p>​    creatNewFile():创建文件，若文件存在，则不创建，返回false。</p>
<p>​    mkdir():创建文件目录</p>
<p>​    mkdirs():创建文件目录，如果上层目录不存在将一起创建</p>
<p>​    delete():删除文件或者文件夹，不走回收站</p>
<p>③IO流原理及流的分类</p>
<p>​    input/output，I/O技术是非常实用的技术，用于设备之间的数据传输，Java程序中，对于数据的输入、输出都是以流的方式进行的。java.io包下提供了各种流类和接口，用以获取不同种类的数据，并通过标准的方法输入或输出数据。</p>
<p>按操作数据单位不同：字节流（8bit）、字符流(16bit)</p>
<p>按数据流的流向不同：输入流、输出流</p>
<p>按流的角色的不同：节点流、处理流</p>
<table>
<thead>
<tr>
<th align="center">抽象基类</th>
<th align="center">字节流</th>
<th align="center">字符流</th>
</tr>
</thead>
<tbody><tr>
<td align="center">输入流</td>
<td align="center">InputSream</td>
<td align="center">Reader</td>
</tr>
<tr>
<td align="center">输出流</td>
<td align="center">OutputStream</td>
<td align="center">Writer</td>
</tr>
</tbody></table>
<p>​    抽象基类                          节点流（或文件流）               缓冲流（处理流的一种）</p>
<pre><code>InputStream                    FileInputStream                    BufferedInputStream</code></pre><p>​    OutputStream                  FileOutputStream                  BufferedOutputStream</p>
<p>​    Reader                             FileReader                             BufferedReader</p>
<p>​    Writer                                FileWriter                               BufferedWriter</p>
<p>④字符流</p>
<p>不能使用字符流处理图片、视频等文件</p>
<p>读取数据：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">test</span><span class="params">()</span></span>&#123;</span><br><span class="line">       <span class="comment">/**</span></span><br><span class="line"><span class="comment">        * read()返回读入的一个字符，如果达到文件末尾返回-1</span></span><br><span class="line"><span class="comment">        * 为了保证流资源一定可以执行关闭操作，需要使用try-catch-finally结构处理异常</span></span><br><span class="line"><span class="comment">        * 读入的文件一定要存在，否则报FileNotFoundException。</span></span><br><span class="line"><span class="comment">        */</span></span><br><span class="line">       <span class="comment">//实例化File类的对象，指明要操作的文件</span></span><br><span class="line">      File file = <span class="keyword">new</span> File(<span class="string">"jdbc.properties"</span>);</span><br><span class="line">       FileReader fr = <span class="keyword">null</span>;</span><br><span class="line">       <span class="keyword">try</span> &#123;</span><br><span class="line">           fr = <span class="keyword">new</span> FileReader(file);</span><br><span class="line">           <span class="keyword">int</span> data ;</span><br><span class="line">           <span class="keyword">while</span>((data = fr.read()) != -<span class="number">1</span>)&#123;</span><br><span class="line">               System.out.print((<span class="keyword">char</span>) data);</span><br><span class="line">           &#125;</span><br><span class="line">       &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">           e.printStackTrace();</span><br><span class="line">       &#125;<span class="keyword">finally</span> &#123;</span><br><span class="line">           <span class="keyword">if</span>(fr != <span class="keyword">null</span>)&#123;</span><br><span class="line">               <span class="keyword">try</span> &#123;</span><br><span class="line">                   fr.close();</span><br><span class="line">               &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">                   e.printStackTrace();</span><br><span class="line">               &#125;</span><br><span class="line">           &#125;</span><br><span class="line">       &#125;</span><br><span class="line">   &#125;</span><br></pre></td></tr></table></figure>

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">test2</span><span class="params">()</span></span>&#123;</span><br><span class="line">       FileReader fr = <span class="keyword">null</span>;</span><br><span class="line">       <span class="keyword">try</span> &#123;</span><br><span class="line">           File file = <span class="keyword">new</span> File(<span class="string">"jdbc.properties"</span>);</span><br><span class="line">           fr = <span class="keyword">new</span> FileReader(file);</span><br><span class="line">           <span class="keyword">char</span> [] buf = <span class="keyword">new</span> <span class="keyword">char</span>[<span class="number">1024</span>];</span><br><span class="line">           <span class="keyword">int</span> lent;</span><br><span class="line">           <span class="keyword">while</span>((lent = fr.read(buf)) != -<span class="number">1</span>)&#123;</span><br><span class="line">              <span class="comment">/* for (int i = 0; i &lt; lent; i++) &#123;</span></span><br><span class="line"><span class="comment">                   System.out.print(buf[i]);</span></span><br><span class="line"><span class="comment">               &#125;*/</span></span><br><span class="line">              String str = <span class="keyword">new</span> String(buf,<span class="number">0</span>,lent);</span><br><span class="line">               System.out.println(str);</span><br><span class="line">           &#125;</span><br><span class="line">       &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">           e.printStackTrace();</span><br><span class="line">       &#125; <span class="keyword">finally</span> &#123;</span><br><span class="line">           <span class="keyword">if</span>(fr != <span class="keyword">null</span>)&#123;</span><br><span class="line">               <span class="keyword">try</span> &#123;</span><br><span class="line">                   fr.close();</span><br><span class="line">               &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">                   e.printStackTrace();</span><br><span class="line">               &#125;</span><br><span class="line">           &#125;</span><br><span class="line">       &#125;</span><br><span class="line">   &#125;</span><br></pre></td></tr></table></figure>

<p>写出数据：</p>
<p>​    输出操作，对应的File可以不存在，并不会报异常。如果不存在，在输出的过程中，会自动创建此文件；如果文件存在:FileWriter(file)/FileWriter(file,false)会对原有文件覆盖，FileWriter(file,true)不会覆盖原有文件，而是在原有文件的基础上追加内容；</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">test3</span><span class="params">()</span></span>&#123;</span><br><span class="line">       FileWriter fw = <span class="keyword">null</span>;</span><br><span class="line">       <span class="keyword">try</span> &#123;</span><br><span class="line">           File file = <span class="keyword">new</span> File(<span class="string">"hello.txt"</span>);</span><br><span class="line">           fw = <span class="keyword">new</span> FileWriter(file,<span class="keyword">false</span>);</span><br><span class="line">           fw.write(<span class="string">"good good study ! day day up !"</span>);</span><br><span class="line">       &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">           e.printStackTrace();</span><br><span class="line">       &#125; <span class="keyword">finally</span> &#123;</span><br><span class="line">           <span class="keyword">if</span>(fw != <span class="keyword">null</span>)&#123;</span><br><span class="line">               <span class="keyword">try</span> &#123;</span><br><span class="line">                   fw.close();</span><br><span class="line">               &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">                   e.printStackTrace();</span><br><span class="line">               &#125;</span><br><span class="line">           &#125;</span><br><span class="line">       &#125;</span><br><span class="line">   &#125;</span><br></pre></td></tr></table></figure>

<p>⑤字节流</p>
<p>图片的复制操作</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">test4</span><span class="params">()</span></span>&#123;</span><br><span class="line">      FileInputStream fis = <span class="keyword">null</span>;</span><br><span class="line">      FileOutputStream fos = <span class="keyword">null</span>;</span><br><span class="line">      <span class="keyword">try</span> &#123;</span><br><span class="line">          File file = <span class="keyword">new</span> File(<span class="string">"1.jpg"</span>);</span><br><span class="line">          File dec = <span class="keyword">new</span> File(<span class="string">"2.jpg"</span>);</span><br><span class="line"></span><br><span class="line">          fis = <span class="keyword">new</span> FileInputStream(file);</span><br><span class="line">          fos = <span class="keyword">new</span> FileOutputStream(dec);</span><br><span class="line"></span><br><span class="line">          <span class="keyword">byte</span> [] by = <span class="keyword">new</span> <span class="keyword">byte</span> [<span class="number">1024</span>];</span><br><span class="line">          <span class="keyword">int</span> len ;</span><br><span class="line">          <span class="keyword">while</span>((len = fis.read(by)) != -<span class="number">1</span>)&#123;</span><br><span class="line">              fos.write(by,<span class="number">0</span>,len);</span><br><span class="line">          &#125;</span><br><span class="line">      &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">          e.printStackTrace();</span><br><span class="line">      &#125; <span class="keyword">finally</span> &#123;</span><br><span class="line">          <span class="keyword">try</span> &#123;</span><br><span class="line">              <span class="keyword">if</span>(fis != <span class="keyword">null</span>)</span><br><span class="line">                  fis.close();</span><br><span class="line">          &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">              e.printStackTrace();</span><br><span class="line">          &#125;</span><br><span class="line">          <span class="keyword">try</span> &#123;</span><br><span class="line">              <span class="keyword">if</span>(fos != <span class="keyword">null</span>)</span><br><span class="line">                  fos.close();</span><br><span class="line">          &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">              e.printStackTrace();</span><br><span class="line">          &#125;</span><br><span class="line">      &#125;</span><br><span class="line">  &#125;</span><br></pre></td></tr></table></figure>

<p>⑥缓冲流</p>
<p>作用：提高流的读取、写入速度，原因是内部提供了一个缓冲区。</p>
<p>BufferedInputStream</p>
<p>BufferedOutputStream</p>
<p>BufferedReader</p>
<p> BufferedWriter</p>
<p>关闭流时，外层流关闭后，内层流自动关闭，不再需要手动关闭。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">File file = <span class="keyword">new</span> File(<span class="string">"2.jpg"</span>);</span><br><span class="line">   FileInputStream fis = <span class="keyword">new</span> FileInputStream(file);</span><br><span class="line">   BufferedInputStream bis = <span class="keyword">new</span> BufferedInputStream(fis);</span><br></pre></td></tr></table></figure>

<p>⑦转换流（属于字符流）</p>
<p>​    转换流提供了字节流和字符流之间的转换</p>
<p>​    InputStreamReader 将InputStream转换为Reader  字节的输入流转换为字符的输入流</p>
<p>​    OutputStreamWriter将Writer转换为OutputStream  字符输出流转换为字节输出流</p>
<p>​    很多时候我们使用转换流来处理文件乱码问题，实现编码和解码的功能。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Test</span></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 转换流测试</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">test</span><span class="params">()</span></span>&#123;</span><br><span class="line">    InputStreamReader isr = <span class="keyword">null</span>;</span><br><span class="line">    OutputStreamWriter osw = <span class="keyword">null</span>;</span><br><span class="line">    <span class="keyword">try</span> &#123;</span><br><span class="line">        File file = <span class="keyword">new</span> File(<span class="string">"古诗.txt"</span>);</span><br><span class="line">        File dest = <span class="keyword">new</span> File(<span class="string">"复制.txt"</span>);</span><br><span class="line"></span><br><span class="line">        isr = <span class="keyword">new</span> InputStreamReader(<span class="keyword">new</span> FileInputStream(file),<span class="string">"utf-8"</span>);</span><br><span class="line"></span><br><span class="line">        osw = <span class="keyword">new</span> OutputStreamWriter(<span class="keyword">new</span> FileOutputStream(dest),<span class="string">"utf-8"</span>);</span><br><span class="line"></span><br><span class="line">        <span class="keyword">char</span> [] buf = <span class="keyword">new</span> <span class="keyword">char</span>[<span class="number">10</span>];</span><br><span class="line">        <span class="keyword">int</span> lent ;</span><br><span class="line">        <span class="keyword">while</span>((lent = isr.read(buf)) != -<span class="number">1</span>)&#123;</span><br><span class="line">            osw.write(buf,<span class="number">0</span>,lent);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">        e.printStackTrace();</span><br><span class="line">    &#125; <span class="keyword">finally</span> &#123;</span><br><span class="line">        <span class="keyword">if</span>(osw != <span class="keyword">null</span>)&#123;</span><br><span class="line">            <span class="keyword">try</span> &#123;</span><br><span class="line">                osw.close();</span><br><span class="line">            &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">                e.printStackTrace();</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">if</span>(isr != <span class="keyword">null</span>)&#123;</span><br><span class="line">            <span class="keyword">try</span> &#123;</span><br><span class="line">                isr.close();</span><br><span class="line">            &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">                e.printStackTrace();</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>⑧标准的输入、输出流</p>
<p>​    System.in 标准的输入流—-&gt; 键盘输入</p>
<p>​    System.out 标准的输出流—-&gt; 控制台输出</p>
<p>​    可以通过setIn()和setOut()两个方法，对默认设备进行改变。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-20 10:03</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Stream</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        BufferedReader br = <span class="keyword">null</span>;</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            InputStreamReader isr = <span class="keyword">new</span> InputStreamReader(System.in);<span class="comment">//转换流</span></span><br><span class="line">            br = <span class="keyword">new</span> BufferedReader(isr);<span class="comment">//缓冲流</span></span><br><span class="line"></span><br><span class="line">            <span class="keyword">while</span>(<span class="keyword">true</span>)&#123;</span><br><span class="line">                String s = br.readLine();</span><br><span class="line">                System.out.println(s);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125; <span class="keyword">finally</span> &#123;</span><br><span class="line">            <span class="keyword">if</span>(br != <span class="keyword">null</span>)&#123;</span><br><span class="line">                <span class="keyword">try</span> &#123;</span><br><span class="line">                    br.close();</span><br><span class="line">                &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">                    e.printStackTrace();</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>⑨打印流、数据流</p>
<p>PrintStream和PrintWriter: 提供一系列的print()和println()的方法，用于不同数据的输出。</p>
<p>DataInputStream和DataOutputStream:用于操作基本数据类型和String，读取数据的顺序要与写入数据的顺序一致，否则报错！</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">DataInputStream dataInputStream = <span class="keyword">new</span> DataInputStream(<span class="keyword">new</span> FileInputStream(<span class="string">"data.text"</span>));</span><br></pre></td></tr></table></figure>

<p>⑩对象流 </p>
<p>​    ObjectInputStream 和 ObjectOutputStream 用于存储和读取基本数据类型和对象的处理流，它的强大之处就是可以把Java中的对象写入到数据源中，也能把对象从数据源中还原回来。</p>
<p>​    序列化：保存对象   反序列化：读取对象</p>
<p>对象序列化机制：允许把内存中的Java对象转换成平台无关的二进制流，从而允许数据的永久保存到磁盘或者通过网络传输，当其他程序获取了这个二进制流，就可以恢复成原来的Java对象。要求：java类实现了Serializable接口;但是不是序列化static和transient修饰的成员变量;提供了静态常量serialVersionUID，验证的版本一致。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study08;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.Serializable;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-20 10:44</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Animal</span> <span class="keyword">implements</span> <span class="title">Serializable</span> </span>&#123;</span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="keyword">long</span> serialVersionUID = -<span class="number">1666762942900923210L</span>;</span><br><span class="line"></span><br><span class="line">   <span class="keyword">private</span> String name;</span><br><span class="line">   <span class="keyword">private</span>  <span class="keyword">int</span> age;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">Animal</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">Animal</span><span class="params">(String name, <span class="keyword">int</span> age)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.name = name;</span><br><span class="line">        <span class="keyword">this</span>.age = age;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">long</span> <span class="title">getSerialVersionUID</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> serialVersionUID;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getName</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> name;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setName</span><span class="params">(String name)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.name = name;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">getAge</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> age;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setAge</span><span class="params">(<span class="keyword">int</span> age)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.age = age;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">toString</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> <span class="string">"Animal&#123;"</span> +</span><br><span class="line">                <span class="string">"name='"</span> + name + <span class="string">'\''</span> +</span><br><span class="line">                <span class="string">", age="</span> + age +</span><br><span class="line">                <span class="string">'&#125;'</span>;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ObjectStreamTest</span> </span>&#123;</span><br><span class="line">    <span class="meta">@Test</span></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 序列化</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">test</span><span class="params">()</span></span>&#123;</span><br><span class="line">        ObjectOutputStream stream = <span class="keyword">null</span>;</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            stream = <span class="keyword">new</span> ObjectOutputStream(<span class="keyword">new</span> FileOutputStream(<span class="string">"obj.bat"</span>));</span><br><span class="line"></span><br><span class="line">            stream.writeObject(<span class="keyword">new</span> Animal(<span class="string">"猫咪"</span>,<span class="number">2</span>));</span><br><span class="line">            stream.writeObject(<span class="keyword">new</span> Animal(<span class="string">"猫咪2"</span>,<span class="number">3</span>));</span><br><span class="line"></span><br><span class="line">            stream.flush();</span><br><span class="line">        &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125; <span class="keyword">finally</span> &#123;</span><br><span class="line">            <span class="keyword">if</span>(stream != <span class="keyword">null</span>)&#123;</span><br><span class="line">                <span class="keyword">try</span> &#123;</span><br><span class="line">                    stream.close();</span><br><span class="line">                &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">                    e.printStackTrace();</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Test</span></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 反序列化</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">test2</span><span class="params">()</span></span>&#123;</span><br><span class="line">        ObjectInputStream stream = <span class="keyword">null</span>;</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            stream = <span class="keyword">new</span> ObjectInputStream(<span class="keyword">new</span> FileInputStream(<span class="string">"obj.bat"</span>));</span><br><span class="line">            Object o = stream.readObject();</span><br><span class="line">            Object s = stream.readObject();</span><br><span class="line">            <span class="keyword">if</span>( o <span class="keyword">instanceof</span> Animal)&#123;</span><br><span class="line">                Animal an = (Animal)o;</span><br><span class="line">                System.out.println(an);</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">if</span>( s <span class="keyword">instanceof</span> Animal)&#123;</span><br><span class="line">                Animal an = (Animal)s;</span><br><span class="line">                System.out.println(an);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125; <span class="keyword">catch</span> (ClassNotFoundException e) &#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125; <span class="keyword">finally</span> &#123;</span><br><span class="line">            <span class="keyword">if</span>(stream != <span class="keyword">null</span>)&#123;</span><br><span class="line">                <span class="keyword">try</span> &#123;</span><br><span class="line">                    stream.close();</span><br><span class="line">                &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">                    e.printStackTrace();</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p> 11、随机存取文件流</p>
<p>​    RandomAccessFile 直接继承与Object类，且实现了DataInput和DataOutput，既可以读也可以写（即可作为输入流、也可作为输出流）。支持随机访问的方式，程序可以直接跳到文件的任意地方来读或者写；包含一个记录指针，用以标示当前读写的位置。</p>
<p>​    RandomAccessFile 作为输出流，如果写出到的文件不存在，则创建；如果文件存在，则会对原有文件内容进行覆盖（从头覆盖）。</p>
<h3 id="8、网络编程"><a href="#8、网络编程" class="headerlink" title="8、网络编程"></a>8、网络编程</h3><p>①网络编程的概述</p>
<p>​    网络编程中两个主要的问题：</p>
<p>​        1、如何准确的定位网络上的一台或者多台主机；定位主机上的应用。</p>
<p>​        2、找到主机后如何可靠高效的进行数据传输</p>
<p>​    网络编程中的两个要素：</p>
<p>​        1、对应问题一：IP和端口号</p>
<p>​        2、对应问题二：提供网络通信协议：TCP/IP参考模型（应用层、传输层、网络层、物理+数据链路层）</p>
<p>​    通信要素一：</p>
<p>​        IP:唯一的标识Internet上的计算机</p>
<p>​        在Java中使用InetAddress类来代表IP</p>
<p>​        IP分类：IPV4/IPV6 ; 万维网/局域网</p>
<p>​        域名：<a href="http://www.baidu.com" target="_blank" rel="noopener">www.baidu.com</a></p>
<p>​        本地回环地址：localhost/127.0.0.1</p>
<p>​        实例化InetAddress：InetAddress.getByName();InetAddress.getLocalHost();</p>
<p>​        常用方法：getHostName()—-&gt;域名   getHostAddress() —-&gt;ip</p>
<p>​        端口号：标识正在计算机上运行的进程，不同的进程有不同的端口号，规定为一个16位的正数0-65535。公认端口:0-1023;注册端口：1024-49151；动态/私有端口：49152-65535</p>
<p>​        端口号与IP地址的组合得出一个网络套接字：Socket</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">test</span><span class="params">()</span></span>&#123;</span><br><span class="line">    InetAddress address = <span class="keyword">null</span>;</span><br><span class="line">    <span class="keyword">try</span> &#123;</span><br><span class="line">        address = InetAddress.getByName(<span class="string">"www.baidu.com"</span>);</span><br><span class="line">    &#125; <span class="keyword">catch</span> (UnknownHostException e) &#123;</span><br><span class="line">        e.printStackTrace();</span><br><span class="line">    &#125;</span><br><span class="line">    System.out.println(address);</span><br><span class="line">    String hostName = address.getHostName();</span><br><span class="line">    String hostAddress = address.getHostAddress();</span><br><span class="line">    System.out.println(hostName);</span><br><span class="line">    System.out.println(hostAddress);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>​    通信要素二：</p>
<p>​        传输层协议：</p>
<p>​            传输控制协议：TCP  先建立连接，再发送数据。—-&gt;打电话</p>
<p>​            数据报协议：UDP 无需连接，直接发送。—-&gt;对讲机</p>
<p>②TCP网络编程</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">TCPTest</span> </span>&#123;</span><br><span class="line">    <span class="meta">@Test</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">client</span><span class="params">()</span></span>&#123;</span><br><span class="line">        System.out.println(<span class="string">"客户端启动，开始发送数据。。。"</span>);</span><br><span class="line">        Socket socket = <span class="keyword">null</span>;</span><br><span class="line">        OutputStream outputStream = <span class="keyword">null</span>;</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            socket = <span class="keyword">new</span> Socket(<span class="string">"127.0.0.1"</span>,<span class="number">5639</span>);</span><br><span class="line">            outputStream = socket.getOutputStream();</span><br><span class="line">            outputStream.write(<span class="string">"你好！"</span>.getBytes());</span><br><span class="line">        &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125; <span class="keyword">finally</span> &#123;</span><br><span class="line">            <span class="keyword">if</span>(outputStream != <span class="keyword">null</span>)&#123;</span><br><span class="line">                <span class="keyword">try</span> &#123;</span><br><span class="line">                    outputStream.close();</span><br><span class="line">                &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">                    e.printStackTrace();</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">if</span>(socket != <span class="keyword">null</span>)&#123;</span><br><span class="line">                <span class="keyword">try</span> &#123;</span><br><span class="line">                    socket.close();</span><br><span class="line">                &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">                    e.printStackTrace();</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Test</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">server</span><span class="params">()</span></span>&#123;</span><br><span class="line">        System.out.println(<span class="string">"服务端启动成功！等待接受数据。。。。"</span>);</span><br><span class="line">        ServerSocket serverSocket = <span class="keyword">null</span>;</span><br><span class="line">        Socket accept = <span class="keyword">null</span>;</span><br><span class="line">        InputStream inputStream = <span class="keyword">null</span>;</span><br><span class="line">        ByteArrayOutputStream ods = <span class="keyword">null</span>;</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            serverSocket = <span class="keyword">new</span> ServerSocket(<span class="number">5639</span>);</span><br><span class="line">            accept = serverSocket.accept();</span><br><span class="line">            inputStream = accept.getInputStream();</span><br><span class="line">            ods = <span class="keyword">new</span> ByteArrayOutputStream();</span><br><span class="line">            <span class="keyword">byte</span> [] dest = <span class="keyword">new</span> <span class="keyword">byte</span>[<span class="number">5</span>];</span><br><span class="line">            <span class="keyword">int</span> lent;</span><br><span class="line">            <span class="keyword">while</span> ((lent = inputStream.read(dest)) != -<span class="number">1</span>)&#123;</span><br><span class="line">                ods.write(dest,<span class="number">0</span>,lent);</span><br><span class="line">            &#125;</span><br><span class="line">            System.out.println(ods.toString());</span><br><span class="line">        &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125; <span class="keyword">finally</span> &#123;</span><br><span class="line">            <span class="keyword">if</span>(ods != <span class="keyword">null</span>)&#123;</span><br><span class="line">                <span class="keyword">try</span> &#123;</span><br><span class="line">                    ods.close();</span><br><span class="line">                &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">                    e.printStackTrace();</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">if</span>(inputStream != <span class="keyword">null</span>)&#123;</span><br><span class="line">                <span class="keyword">try</span> &#123;</span><br><span class="line">                    inputStream.close();</span><br><span class="line">                &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">                    e.printStackTrace();</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">if</span>(accept != <span class="keyword">null</span>)&#123;</span><br><span class="line">                <span class="keyword">try</span> &#123;</span><br><span class="line">                    accept.close();</span><br><span class="line">                &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">                    e.printStackTrace();</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">if</span>(serverSocket != <span class="keyword">null</span>)&#123;</span><br><span class="line">                <span class="keyword">try</span> &#123;</span><br><span class="line">                    serverSocket.close();</span><br><span class="line">                &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">                    e.printStackTrace();</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>③UDP网络编程</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study09;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.junit.Test;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.net.DatagramPacket;</span><br><span class="line"><span class="keyword">import</span> java.net.DatagramSocket;</span><br><span class="line"><span class="keyword">import</span> java.net.InetAddress;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * UDP协议编程</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-20 16:11</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">UDPTest</span> </span>&#123;</span><br><span class="line">    <span class="meta">@Test</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">send</span><span class="params">()</span></span>&#123;</span><br><span class="line">        DatagramSocket socket = <span class="keyword">null</span>;</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            socket = <span class="keyword">new</span> DatagramSocket();</span><br><span class="line">            String str = <span class="string">"我的天啊"</span>;</span><br><span class="line">            <span class="keyword">byte</span>[] bytes = str.getBytes();</span><br><span class="line">            DatagramPacket packet = <span class="keyword">new</span> DatagramPacket(bytes,<span class="number">0</span>,bytes.length,InetAddress.getLocalHost(),<span class="number">9090</span>);</span><br><span class="line">            socket.send(packet);</span><br><span class="line">        &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125;<span class="keyword">finally</span> &#123;</span><br><span class="line">            <span class="keyword">if</span>(socket != <span class="keyword">null</span>)&#123;</span><br><span class="line">                socket.close();</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Test</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">recive</span><span class="params">()</span></span>&#123;</span><br><span class="line">        DatagramSocket socket = <span class="keyword">null</span>;</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            socket = <span class="keyword">new</span> DatagramSocket(<span class="number">9090</span>);</span><br><span class="line">            <span class="keyword">byte</span> [] buff = <span class="keyword">new</span> <span class="keyword">byte</span>[<span class="number">20</span>];</span><br><span class="line">            DatagramPacket packet = <span class="keyword">new</span> DatagramPacket(buff,<span class="number">0</span>,buff.length);</span><br><span class="line">            socket.receive(packet);</span><br><span class="line">            System.out.println(<span class="keyword">new</span> String(packet.getData(),<span class="number">0</span>,packet.getLength()));</span><br><span class="line">        &#125;<span class="keyword">catch</span>(IOException e)&#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125;<span class="keyword">finally</span> &#123;</span><br><span class="line">            <span class="keyword">if</span>(socket != <span class="keyword">null</span>)&#123;</span><br><span class="line">                socket.close();</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>④URL编程</p>
<p>URL:统一资源定位符，它表示Internet上某一资源的地址。<a href="https://www.baidu.com" target="_blank" rel="noopener">https://www.baidu.com</a></p>
<p>URI:统一资源标识符，<a href="http://www.baidu.com" target="_blank" rel="noopener">www.baidu.com</a></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study09;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.FileOutputStream;</span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.io.InputStream;</span><br><span class="line"><span class="keyword">import</span> java.net.HttpURLConnection;</span><br><span class="line"><span class="keyword">import</span> java.net.URL;</span><br><span class="line"><span class="keyword">import</span> java.util.Base64;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-20 17:03</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">URLTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        HttpURLConnection connection = <span class="keyword">null</span>;</span><br><span class="line">        InputStream inputStream = <span class="keyword">null</span>;</span><br><span class="line">        FileOutputStream stream = <span class="keyword">null</span>;</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            URL url = <span class="keyword">new</span> URL(<span class="string">"https://timgsa.baidu.com/timg?image&amp;quality=80&amp;size=b9999_10000&amp;sec=1574250661866&amp;di=4559a0b4220146da9fec6ee73a652ad3&amp;imgtype=0&amp;src=http%3A%2F%2Fimg01.mall.cmbchina.com%2FProductLongDesc%2F2017-12-18%2Fee8f0968-3256-48b2-9338-9b85578370e1.jpg"</span>);</span><br><span class="line">            connection = (HttpURLConnection) url.openConnection();</span><br><span class="line">            connection.connect();</span><br><span class="line">            inputStream = connection.getInputStream();</span><br><span class="line">            stream = <span class="keyword">new</span> FileOutputStream(<span class="string">"2.jpg"</span>);</span><br><span class="line">            <span class="keyword">byte</span> [] dd = <span class="keyword">new</span> <span class="keyword">byte</span>[<span class="number">1024</span>];</span><br><span class="line">            <span class="keyword">int</span> lent;</span><br><span class="line">            <span class="keyword">while</span> ((lent = inputStream.read(dd)) != -<span class="number">1</span>)&#123;</span><br><span class="line">                stream.write(dd,<span class="number">0</span>,lent);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125; <span class="keyword">finally</span> &#123;</span><br><span class="line">            <span class="keyword">if</span>(stream != <span class="keyword">null</span>)&#123;</span><br><span class="line">                <span class="keyword">try</span> &#123;</span><br><span class="line">                    stream.close();</span><br><span class="line">                &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">                    e.printStackTrace();</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">if</span>(inputStream != <span class="keyword">null</span>)&#123;</span><br><span class="line">                <span class="keyword">try</span> &#123;</span><br><span class="line">                    inputStream.close();</span><br><span class="line">                &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">                    e.printStackTrace();</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">if</span>(connection != <span class="keyword">null</span>)&#123;</span><br><span class="line">                connection.disconnect();</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        System.out.println(<span class="string">"下载完成！"</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="9、反射"><a href="#9、反射" class="headerlink" title="9、反射"></a>9、反射</h3><p>①反射机制概述</p>
<p>​    Java Reflection 反射被视为动态语言的关键，反射机制允许程序在执行期借助于Reflection API取得任何类的内部信息，并能直接操作任意对象的内部属性及方法。</p>
<p>​    通过反射，可以调用类的私有的结构。（不使用反射不能调用）</p>
<p>​    类的加载过程：程序经过javac.exe命令后，会生成一个或多个字节码文件（.calss）。接着我们使用java.exe命令对某个字节码文件进行解释运行。相当于将某个字节码文件加载到内存中。此过程就成为类的加载。加载到内存中的类 ，我们就称为运行时类，此运行时类，就作为Class的一个实例。加载到内存中的运行时类，会缓存一定的时间，在此时间内，我们可以通过不同的方式来获取此运行时类。</p>
<p>②获取Class实例的方式</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study10;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.ybjt.bean.User;</span><br><span class="line"><span class="keyword">import</span> org.junit.Test;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.lang.reflect.Constructor;</span><br><span class="line"><span class="keyword">import</span> java.lang.reflect.Field;</span><br><span class="line"><span class="keyword">import</span> java.lang.reflect.Method;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-20 21:40</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ReflectTest</span> </span>&#123;</span><br><span class="line">    <span class="meta">@Test</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">test</span><span class="params">()</span> <span class="keyword">throws</span> Exception </span>&#123;</span><br><span class="line">        Class&lt;User&gt; clazz = User.class;</span><br><span class="line">        Constructor&lt;User&gt; constructor = clazz.getConstructor(String.class);</span><br><span class="line">        User user = constructor.newInstance(<span class="string">"张三"</span>);</span><br><span class="line">        System.out.println(user);</span><br><span class="line"></span><br><span class="line">        Method song = clazz.getMethod(<span class="string">"song"</span>);</span><br><span class="line">        song.invoke(user);</span><br><span class="line"></span><br><span class="line">        Field age = clazz.getDeclaredField(<span class="string">"age"</span>);</span><br><span class="line">        age.setAccessible(<span class="keyword">true</span>);</span><br><span class="line">        age.set(user,<span class="string">"28"</span>);</span><br><span class="line">        System.out.println(user);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 获取Class类的实例</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="meta">@Test</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">test2</span><span class="params">()</span> <span class="keyword">throws</span> Exception </span>&#123;</span><br><span class="line">        <span class="comment">//方式一</span></span><br><span class="line">        Class&lt;User&gt; userClass = User.class;</span><br><span class="line">        System.out.println(userClass.toString());</span><br><span class="line">        <span class="comment">//方式二</span></span><br><span class="line">        User user = <span class="keyword">new</span> User(<span class="string">"张三"</span>);</span><br><span class="line">        Class&lt;? extends User&gt; aClass = user.getClass();</span><br><span class="line">        System.out.println(aClass.toString());</span><br><span class="line">        <span class="comment">//方式三</span></span><br><span class="line">        Class&lt;?&gt; aClass1 = Class.forName(<span class="string">"com.ybjt.bean.User"</span>);</span><br><span class="line">        Constructor&lt;?&gt; constructor = aClass1.getConstructor(String.class);</span><br><span class="line">        Object o = constructor.newInstance(<span class="string">"李四"</span>);</span><br><span class="line">        Field age = aClass1.getDeclaredField(<span class="string">"age"</span>);</span><br><span class="line">        Field address = aClass1.getDeclaredField(<span class="string">"address"</span>);</span><br><span class="line">        address.setAccessible(<span class="keyword">true</span>);</span><br><span class="line">        address.set(o,<span class="string">"中关村"</span>);</span><br><span class="line">        age.setAccessible(<span class="keyword">true</span>);</span><br><span class="line">        age.set(o,<span class="string">"28"</span>);</span><br><span class="line">        System.out.println(o.toString());</span><br><span class="line"></span><br><span class="line">        <span class="comment">//方式四 使用类的加载器</span></span><br><span class="line">        ClassLoader classLoader = ReflectTest.class.getClassLoader();</span><br><span class="line">        Class&lt;?&gt; aClass2 = classLoader.loadClass(<span class="string">"com.ybjt.bean.User"</span>);</span><br><span class="line">        System.out.println(aClass2);</span><br><span class="line"></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>说明：只要数组的元素与维度一样，就是同一个Class。</p>
<p>③类加载器</p>
<p>​    类的加载（将类的class文件读入到内存，并为之创建一个Class对象，此过程由类的加载器完成。）—-&gt;</p>
<p>​    类的链接（将类的二进制数据合并带JRE中）—-&gt;类的初始化（JVM负责对类进行初始化）</p>
<p>④获取类的结构</p>
<p>​    getFiles():获取当前运行时类及其父类中声明为public访问权限的属性。</p>
<p>​    getDeclaredFiles()::获取当前运行时类当中声明的所有属性，不包含父类的属性。</p>
<p>​    getMethods():获取当前运行时类及其父类中声明为public访问权限的方法。</p>
<p>​    getDeclaredMethods()::获取当前运行时类当中声明的所有方法，不包含父类的方法。</p>
<p>​    getConstructors():获取当前运行时类及其父类中声明为public访问权限的构造器。</p>
<p>​    getDeclaredConstructors()::获取当前运行时类当中声明的所有构造器。</p>
<p>⑤动态代理</p>
<p>​    使用一个代理将对象包装起来，然后用该代理对象取代原始对象。任何对原始对象的调用都要通过代理，代理对象决定是否以及何时将方法调用转到原始对象上。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study10;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 静态代理</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-21 12:11</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">StaticProxyTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        MacFactory mac = <span class="keyword">new</span> MacFactory();</span><br><span class="line">        CenterFactory center = <span class="keyword">new</span> CenterFactory(mac);</span><br><span class="line">        center.prodeuce();</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">//接口定义功能</span></span><br><span class="line"><span class="class"><span class="keyword">interface</span> <span class="title">ComputerFactory</span></span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">prodeuce</span><span class="params">()</span></span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">MacFactory</span> <span class="keyword">implements</span> <span class="title">ComputerFactory</span></span>&#123;</span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">prodeuce</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        System.out.println(<span class="string">"生产16寸MacBook pro"</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">CenterFactory</span> <span class="keyword">implements</span> <span class="title">ComputerFactory</span></span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">private</span> ComputerFactory macfactory;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">CenterFactory</span><span class="params">(ComputerFactory macfactory)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.macfactory = macfactory;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">prodeuce</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        System.out.println(<span class="string">"生产包装配件"</span>);</span><br><span class="line">        macfactory.prodeuce();</span><br><span class="line">        System.out.println(<span class="string">"售后服务"</span>);</span><br><span class="line"></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study10;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.lang.reflect.InvocationHandler;</span><br><span class="line"><span class="keyword">import</span> java.lang.reflect.Method;</span><br><span class="line"><span class="keyword">import</span> java.lang.reflect.Proxy;</span><br><span class="line"></span><br><span class="line"><span class="comment">/** 动态代理</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-21 12:24</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ProxyTest</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        SupperMan supperMan = <span class="keyword">new</span> SupperMan();</span><br><span class="line">        Man proxyInstance = (Man) ProxyFactory.getProxyInstance(supperMan);</span><br><span class="line">        proxyInstance.getBelive();</span><br><span class="line">        proxyInstance.eat(<span class="string">"麻辣汤"</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 接口定义功能</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="class"><span class="keyword">interface</span> <span class="title">Man</span></span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">getBelive</span><span class="params">()</span></span>;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">eat</span><span class="params">(String food)</span></span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 被代理类</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">SupperMan</span> <span class="keyword">implements</span> <span class="title">Man</span></span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">getBelive</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        System.out.println(<span class="string">"I belive I can Fly"</span>);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">eat</span><span class="params">(String food)</span> </span>&#123;</span><br><span class="line">        System.out.println(<span class="string">"超人喜欢吃"</span>+food);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 获取代理类对象</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">ProxyFactory</span></span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> Object <span class="title">getProxyInstance</span><span class="params">(Object obj)</span></span>&#123;</span><br><span class="line">        MyHandel handel = <span class="keyword">new</span> MyHandel(obj);</span><br><span class="line">        <span class="keyword">return</span> Proxy.newProxyInstance(obj.getClass().getClassLoader(),obj.getClass().getInterfaces(),handel);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">MyHandel</span> <span class="keyword">implements</span> <span class="title">InvocationHandler</span></span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">private</span> Object object;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">MyHandel</span><span class="params">(Object object)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.object = object;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> Object <span class="title">invoke</span><span class="params">(Object proxy, Method method, Object[] args)</span> <span class="keyword">throws</span> Throwable </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> method.invoke(object,args);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="10-、JDK8-新特性"><a href="#10-、JDK8-新特性" class="headerlink" title="10 、JDK8 新特性"></a>10 、JDK8 新特性</h3><p>①Lambda表达式</p>
<p>​    格式： -&gt; lambda操作符、箭头操作符</p>
<p>​                -&gt;左边：lambda形参列表（接口中抽象方法的形参列表）lambda形参列表的类型可以省略，只有一个参数其一对（）可以省略，其他情况都不能省略。</p>
<p>​                -&gt;右边：lambda体（重写的方法的方法体），lambda体使用一对{}包裹，如果内部只有一条执行语句（可能是return语句），可以省略{}和return关键字</p>
<p>​    Lambda表达式的本质作为接口的实例：函数式接口</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ybjt.study10;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.junit.Test;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Comparator;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxh</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@create</span> 2019-11-21 14:30</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">LambdaTest</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Test</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">test</span><span class="params">()</span></span>&#123;</span><br><span class="line">        Comparator com =   <span class="keyword">new</span> Comparator&lt;Integer&gt;()&#123;</span><br><span class="line"></span><br><span class="line">            <span class="meta">@Override</span></span><br><span class="line">            <span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">compare</span><span class="params">(Integer o1, Integer o2)</span> </span>&#123;</span><br><span class="line">                <span class="keyword">return</span> o1.compareTo(o2);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;;</span><br><span class="line">        <span class="keyword">int</span> compare = com.compare(<span class="number">23</span>, <span class="number">56</span>);</span><br><span class="line">        System.out.println(compare);</span><br><span class="line"></span><br><span class="line">        System.out.println(<span class="string">"***********************************"</span>);</span><br><span class="line"></span><br><span class="line">        Comparator&lt;Integer&gt; c =(o1,o2)-&gt;o1.compareTo(o2);</span><br><span class="line">        <span class="keyword">int</span> pare = c.compare(<span class="number">99</span>, <span class="number">56</span>);</span><br><span class="line">        System.out.println(pare);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>②函数式接口</p>
<p>​    如果一个接口中只声明了一个抽象方法，就叫函数式接口。@FunctionalInterface ,匿名实现类都可以用Lambda表达式来写。</p>
<p>Java内置的4 大核心函数式接口：</p>
<p>​    消费型接口Consumer<t>     void accept(T t)</t></p>
<p>​    供给型接口Supplier<t>        T get()</t></p>
<p>​    函数型接口Function&lt;T,R&gt;    R apply(T t)</p>
<p>​    断定型接口Predicate<t>      boolean test(T t)</t></p>
<p>③Stream API</p>
<p>​    关注的是数据的运算，与cpu交互。</p>
<p>④optional类</p>
<p>​    为了在程序中避免出现空指针异常</p>

      

      
        <div class="page-reward">
          <a href="javascript:;" class="page-reward-btn tooltip-top">
            <div class="tooltip tooltip-east">
            <span class="tooltip-item">
              赏
            </span>
            <span class="tooltip-content">
              <span class="tooltip-text">
                <span class="tooltip-inner">
                  <p class="reward-p"><i class="icon icon-quo-left"></i>Java是世界上最好的语言<i class="icon icon-quo-right"></i></p>
                  <div class="reward-box">
                    
                    
                  </div>
                </span>
              </span>
            </span>
          </div>
          </a>
        </div>
      
    </div>
    <div class="article-info article-info-index">
      
      
      

      

      
        
<div class="share-btn share-icons tooltip-left">
  <div class="tooltip tooltip-east">
    <span class="tooltip-item">
      <a href="javascript:;" class="share-sns share-outer">
        <i class="icon icon-share"></i>
      </a>
    </span>
    <span class="tooltip-content">
      <div class="share-wrap">
        <div class="share-icons">
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="icon icon-weibo"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="icon icon-weixin"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="icon icon-qq"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="icon icon-douban"></i>
          </a>
          <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a>
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="icon icon-facebook"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="icon icon-twitter"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="icon icon-google"></i>
          </a>
        </div>
      </div>
    </span>
  </div>
</div>

<div class="page-modal wx-share js-wx-box">
    <a class="close js-modal-close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//pan.baidu.com/share/qrcode?url=http://yoursite.com/2019/08/27/Java基础复习/" alt="微信分享二维码">
    </div>
</div>

<div class="mask js-mask"></div>
      
      <div class="clearfix"></div>
    </div>
  </div>
</article>

  
<nav id="article-nav">
  
    <a href="/2019/08/29/springboot入门/" id="article-nav-newer" class="article-nav-link-wrap">
      <i class="icon-circle-left"></i>
      <div class="article-nav-title">
        
          springboot入门
        
      </div>
    </a>
  
  
    <a href="/2019/08/23/hello-world/" id="article-nav-older" class="article-nav-link-wrap">
      <div class="article-nav-title">Hello World</div>
      <i class="icon-circle-right"></i>
    </a>
  
</nav>


<aside class="wrap-side-operation">
    <div class="mod-side-operation">
        
        <div class="jump-container" id="js-jump-container" style="display:none;">
            <a href="javascript:void(0)" class="mod-side-operation__jump-to-top">
                <i class="icon-font icon-back"></i>
            </a>
            <div id="js-jump-plan-container" class="jump-plan-container" style="top: -11px;">
                <i class="icon-font icon-plane jump-plane"></i>
            </div>
        </div>
        
        
        <div class="toc-container tooltip-left">
            <i class="icon-font icon-category"></i>
            <div class="tooltip tooltip-east">
                <span class="tooltip-item">
                </span>
                <span class="tooltip-content">
                    <div class="toc-article">
                    <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#Java基础复习"><span class="toc-number">1.</span> <span class="toc-text">Java基础复习</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#一、绪论（2019-08-27）"><span class="toc-number">1.1.</span> <span class="toc-text">一、绪论（2019.08.27）</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#１、计算机包括硬件和软件两个部分。"><span class="toc-number">1.1.1.</span> <span class="toc-text">１、计算机包括硬件和软件两个部分。</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2、世界上没有最好的语言，每种语言都有各自的优点和缺点。（其实Java是世界上最好的语言）。"><span class="toc-number">1.1.2.</span> <span class="toc-text">2、世界上没有最好的语言，每种语言都有各自的优点和缺点。（其实Java是世界上最好的语言）。</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3、冯诺依曼体系结构"><span class="toc-number">1.1.3.</span> <span class="toc-text">3、冯诺依曼体系结构</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4、IT行业三大定律"><span class="toc-number">1.1.4.</span> <span class="toc-text">4、IT行业三大定律 :</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5、存储设备"><span class="toc-number">1.1.5.</span> <span class="toc-text">5、存储设备</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#６、操作系统是运行在计算机上的最重要的程序，它可以管理和控制计算机的活动。"><span class="toc-number">1.1.6.</span> <span class="toc-text">６、操作系统是运行在计算机上的最重要的程序，它可以管理和控制计算机的活动。</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#７、万维网world-wide-web"><span class="toc-number">1.1.7.</span> <span class="toc-text">７、万维网world wide web</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8、java语言应用场景："><span class="toc-number">1.1.8.</span> <span class="toc-text">8、java语言应用场景：</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#二、Java语言概述（2019-08-28）"><span class="toc-number">1.2.</span> <span class="toc-text">二、Java语言概述（2019.08.28）</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1、人机交互方式"><span class="toc-number">1.2.1.</span> <span class="toc-text">1、人机交互方式</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2、Java语言的分类"><span class="toc-number">1.2.2.</span> <span class="toc-text">2、Java语言的分类</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#JavaSE标准版、JavaEE企业版、JavaME移动版"><span class="toc-number">1.2.3.</span> <span class="toc-text">JavaSE标准版、JavaEE企业版、JavaME移动版</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3、Java语言的特点"><span class="toc-number">1.2.4.</span> <span class="toc-text">3、Java语言的特点</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4、JVM"><span class="toc-number">1.2.5.</span> <span class="toc-text">4、JVM</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5、JDK"><span class="toc-number">1.2.6.</span> <span class="toc-text">5、JDK</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6、JDK的安装目录"><span class="toc-number">1.2.7.</span> <span class="toc-text">6、JDK的安装目录</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7、环境变量的配置path"><span class="toc-number">1.2.8.</span> <span class="toc-text">7、环境变量的配置path</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8、第一个Java程序"><span class="toc-number">1.2.9.</span> <span class="toc-text">8、第一个Java程序</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9、Java中的注释"><span class="toc-number">1.2.10.</span> <span class="toc-text">9、Java中的注释</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#10、API"><span class="toc-number">1.2.11.</span> <span class="toc-text">10、API</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#三、Java基础"><span class="toc-number">1.3.</span> <span class="toc-text">三、Java基础</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1、关键字与保留字"><span class="toc-number">1.3.1.</span> <span class="toc-text">1、关键字与保留字</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2、标识符"><span class="toc-number">1.3.2.</span> <span class="toc-text">2、标识符</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3、变量"><span class="toc-number">1.3.3.</span> <span class="toc-text">3、变量</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1、概念："><span class="toc-number">1.3.3.1.</span> <span class="toc-text">1、概念：</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2、使用："><span class="toc-number">1.3.3.2.</span> <span class="toc-text">2、使用：</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#3、基本数据类型的分类-8种"><span class="toc-number">1.3.3.3.</span> <span class="toc-text">3、基本数据类型的分类(8种)</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4、字符集"><span class="toc-number">1.3.4.</span> <span class="toc-text">4、字符集</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5、类型转换（不包含boolean）"><span class="toc-number">1.3.5.</span> <span class="toc-text">5、类型转换（不包含boolean）</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1、自动类型转换"><span class="toc-number">1.3.5.1.</span> <span class="toc-text">1、自动类型转换</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2、强制类型转换"><span class="toc-number">1.3.5.2.</span> <span class="toc-text">2、强制类型转换</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6、String-字符串类型"><span class="toc-number">1.3.6.</span> <span class="toc-text">6、String 字符串类型</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7、进制的转换"><span class="toc-number">1.3.7.</span> <span class="toc-text">7、进制的转换</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8、运算符"><span class="toc-number">1.3.8.</span> <span class="toc-text">8、运算符</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1、算术运算符"><span class="toc-number">1.3.8.1.</span> <span class="toc-text">1、算术运算符</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2、赋值运算符"><span class="toc-number">1.3.8.2.</span> <span class="toc-text">2、赋值运算符</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#3、比较运算符（关系运算符）"><span class="toc-number">1.3.8.3.</span> <span class="toc-text">3、比较运算符（关系运算符）</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#4、逻辑运算符"><span class="toc-number">1.3.8.4.</span> <span class="toc-text">4、逻辑运算符</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#5、位运算符"><span class="toc-number">1.3.8.5.</span> <span class="toc-text">5、位运算符</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#6、三元运算符"><span class="toc-number">1.3.8.6.</span> <span class="toc-text">6、三元运算符</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#7、运算符的优先级"><span class="toc-number">1.3.8.7.</span> <span class="toc-text">7、运算符的优先级</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9、流程控制（顺序结构、分支结构、循环结构）"><span class="toc-number">1.3.9.</span> <span class="toc-text">9、流程控制（顺序结构、分支结构、循环结构）</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1、if…else"><span class="toc-number">1.3.9.1.</span> <span class="toc-text">1、if…else..</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2、switch…case…"><span class="toc-number">1.3.9.2.</span> <span class="toc-text">2、switch…case…</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#3、for"><span class="toc-number">1.3.9.3.</span> <span class="toc-text">3、for</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#4、while"><span class="toc-number">1.3.9.4.</span> <span class="toc-text">4、while</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#5、do…while…"><span class="toc-number">1.3.9.5.</span> <span class="toc-text">5、do…while…</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#6、嵌套循环"><span class="toc-number">1.3.9.6.</span> <span class="toc-text">6、嵌套循环</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#7、break-continue"><span class="toc-number">1.3.9.7.</span> <span class="toc-text">7、break/continue</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#10、数组"><span class="toc-number">1.3.10.</span> <span class="toc-text">10、数组</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#四、面向对象"><span class="toc-number">1.4.</span> <span class="toc-text">四、面向对象</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#２、面向对象的两个要素"><span class="toc-number">1.4.1.</span> <span class="toc-text">２、面向对象的两个要素</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3、类的成员"><span class="toc-number">1.4.2.</span> <span class="toc-text">3、类的成员</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4、万物皆对象"><span class="toc-number">1.4.3.</span> <span class="toc-text">4、万物皆对象</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5、匿名对象"><span class="toc-number">1.4.4.</span> <span class="toc-text">5、匿名对象</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6、方法"><span class="toc-number">1.4.5.</span> <span class="toc-text">6、方法</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7、可变参数"><span class="toc-number">1.4.6.</span> <span class="toc-text">7、可变参数</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8、值传递机制"><span class="toc-number">1.4.7.</span> <span class="toc-text">8、值传递机制</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9、封装性"><span class="toc-number">1.4.8.</span> <span class="toc-text">9、封装性</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#10、构造器"><span class="toc-number">1.4.9.</span> <span class="toc-text">10、构造器</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#11、JavaBean"><span class="toc-number">1.4.10.</span> <span class="toc-text">11、JavaBean</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#12、this关键字"><span class="toc-number">1.4.11.</span> <span class="toc-text">12、this关键字</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#13、package"><span class="toc-number">1.4.12.</span> <span class="toc-text">13、package</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#14、MVC"><span class="toc-number">1.4.13.</span> <span class="toc-text">14、MVC</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#15、import"><span class="toc-number">1.4.14.</span> <span class="toc-text">15、import</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#16、继承性"><span class="toc-number">1.4.15.</span> <span class="toc-text">16、继承性</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#17、Object类"><span class="toc-number">1.4.16.</span> <span class="toc-text">17、Object类</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#18、方法的重写"><span class="toc-number">1.4.17.</span> <span class="toc-text">18、方法的重写</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#19、supper关键字"><span class="toc-number">1.4.18.</span> <span class="toc-text">19、supper关键字</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#20、多态性"><span class="toc-number">1.4.19.</span> <span class="toc-text">20、多态性</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#21、instanceof关键字"><span class="toc-number">1.4.20.</span> <span class="toc-text">21、instanceof关键字</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#22、Object类和包装类"><span class="toc-number">1.4.21.</span> <span class="toc-text">22、Object类和包装类</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#22、static关键字"><span class="toc-number">1.4.22.</span> <span class="toc-text">22、static关键字</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#23、单例设计模式"><span class="toc-number">1.4.23.</span> <span class="toc-text">23、单例设计模式</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#24、main方法的使用说明"><span class="toc-number">1.4.24.</span> <span class="toc-text">24、main方法的使用说明</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#25、代码块"><span class="toc-number">1.4.25.</span> <span class="toc-text">25、代码块</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#26、final关键字"><span class="toc-number">1.4.26.</span> <span class="toc-text">26、final关键字</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#27、抽象类和抽象方法"><span class="toc-number">1.4.27.</span> <span class="toc-text">27、抽象类和抽象方法</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#28、模板方法的设计模式"><span class="toc-number">1.4.28.</span> <span class="toc-text">28、模板方法的设计模式</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#29、interface接口"><span class="toc-number">1.4.29.</span> <span class="toc-text">29、interface接口</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#30、内部类"><span class="toc-number">1.4.30.</span> <span class="toc-text">30、内部类</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#31、异常处理"><span class="toc-number">1.4.31.</span> <span class="toc-text">31、异常处理</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#五、Java高级"><span class="toc-number">1.5.</span> <span class="toc-text">五、Java高级</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1、多线程"><span class="toc-number">1.5.1.</span> <span class="toc-text">1、多线程</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2、Java常用类"><span class="toc-number">1.5.2.</span> <span class="toc-text">2、Java常用类</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1、String类"><span class="toc-number">1.5.2.1.</span> <span class="toc-text">1、String类</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2、JDK1-8之前时间API"><span class="toc-number">1.5.2.2.</span> <span class="toc-text">2、JDK1.8之前时间API</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#3、JDK1-8中的时间API"><span class="toc-number">1.5.2.3.</span> <span class="toc-text">3、JDK1.8中的时间API</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#4、instant-瞬时"><span class="toc-number">1.5.2.4.</span> <span class="toc-text">4、instant 瞬时</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#5、DateTimeFormatter格式化解析时间日期"><span class="toc-number">1.5.2.5.</span> <span class="toc-text">5、DateTimeFormatter格式化解析时间日期</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#6、Java比较器"><span class="toc-number">1.5.2.6.</span> <span class="toc-text">6、Java比较器</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#7、System、Math、BigInteger、BigDecimal"><span class="toc-number">1.5.2.7.</span> <span class="toc-text">7、System、Math、BigInteger、BigDecimal</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3、枚举类"><span class="toc-number">1.5.3.</span> <span class="toc-text">3、枚举类</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4、注解（Annotation-JDK5-0）"><span class="toc-number">1.5.4.</span> <span class="toc-text">4、注解（Annotation JDK5.0）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5、集合"><span class="toc-number">1.5.5.</span> <span class="toc-text">5、集合</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6、泛型（JDK5-0）"><span class="toc-number">1.5.6.</span> <span class="toc-text">6、泛型（JDK5.0）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7、IO流"><span class="toc-number">1.5.7.</span> <span class="toc-text">7、IO流</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8、网络编程"><span class="toc-number">1.5.8.</span> <span class="toc-text">8、网络编程</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9、反射"><span class="toc-number">1.5.9.</span> <span class="toc-text">9、反射</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#10-、JDK8-新特性"><span class="toc-number">1.5.10.</span> <span class="toc-text">10 、JDK8 新特性</span></a></li></ol></li></ol></li></ol>
                    </div>
                </span>
            </div>
        </div>
        
    </div>
</aside>



  
  
  

  

  

  


          </div>
        </div>
      </div>
      <footer id="footer">
  <div class="outer">
    <div id="footer-info">
    	<div class="footer-left">
    		&copy; 2019 zhangxuhui
    	</div>
      	<div class="footer-right">
      		<a href="http://hexo.io/" target="_blank">Hexo</a>  Theme <a href="https://github.com/litten/hexo-theme-yilia" target="_blank">Yilia</a> by Litten
      	</div>
    </div>
  </div>
</footer>
    </div>
    <script>
	var yiliaConfig = {
		mathjax: false,
		isHome: false,
		isPost: true,
		isArchive: false,
		isTag: false,
		isCategory: false,
		open_in_new: false,
		toc_hide_index: true,
		root: "/",
		innerArchive: true,
		showTags: false
	}
</script>

<script>!function(t){function n(e){if(r[e])return r[e].exports;var i=r[e]={exports:{},id:e,loaded:!1};return t[e].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}var r={};n.m=t,n.c=r,n.p="./",n(0)}([function(t,n,r){r(195),t.exports=r(191)},function(t,n,r){var e=r(3),i=r(52),o=r(27),u=r(28),c=r(53),f="prototype",a=function(t,n,r){var s,l,h,v,p=t&a.F,d=t&a.G,y=t&a.S,g=t&a.P,b=t&a.B,m=d?e:y?e[n]||(e[n]={}):(e[n]||{})[f],x=d?i:i[n]||(i[n]={}),w=x[f]||(x[f]={});d&&(r=n);for(s in r)l=!p&&m&&void 0!==m[s],h=(l?m:r)[s],v=b&&l?c(h,e):g&&"function"==typeof h?c(Function.call,h):h,m&&u(m,s,h,t&a.U),x[s]!=h&&o(x,s,v),g&&w[s]!=h&&(w[s]=h)};e.core=i,a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,n,r){var e=r(6);t.exports=function(t){if(!e(t))throw TypeError(t+" is not an object!");return t}},function(t,n){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n,r){var e=r(126)("wks"),i=r(76),o=r(3).Symbol,u="function"==typeof o;(t.exports=function(t){return e[t]||(e[t]=u&&o[t]||(u?o:i)("Symbol."+t))}).store=e},function(t,n){var r={}.hasOwnProperty;t.exports=function(t,n){return r.call(t,n)}},function(t,n,r){var e=r(94),i=r(33);t.exports=function(t){return e(i(t))}},function(t,n,r){t.exports=!r(4)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,n,r){var e=r(2),i=r(167),o=r(50),u=Object.defineProperty;n.f=r(10)?Object.defineProperty:function(t,n,r){if(e(t),n=o(n,!0),e(r),i)try{return u(t,n,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[n]=r.value),t}},function(t,n,r){t.exports=!r(18)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,n,r){var e=r(14),i=r(22);t.exports=r(12)?function(t,n,r){return e.f(t,n,i(1,r))}:function(t,n,r){return t[n]=r,t}},function(t,n,r){var e=r(20),i=r(58),o=r(42),u=Object.defineProperty;n.f=r(12)?Object.defineProperty:function(t,n,r){if(e(t),n=o(n,!0),e(r),i)try{return u(t,n,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[n]=r.value),t}},function(t,n,r){var e=r(40)("wks"),i=r(23),o=r(5).Symbol,u="function"==typeof o;(t.exports=function(t){return e[t]||(e[t]=u&&o[t]||(u?o:i)("Symbol."+t))}).store=e},function(t,n,r){var e=r(67),i=Math.min;t.exports=function(t){return t>0?i(e(t),9007199254740991):0}},function(t,n,r){var e=r(46);t.exports=function(t){return Object(e(t))}},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n,r){var e=r(63),i=r(34);t.exports=Object.keys||function(t){return e(t,i)}},function(t,n,r){var e=r(21);t.exports=function(t){if(!e(t))throw TypeError(t+" is not an object!");return t}},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n){var r=0,e=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+e).toString(36))}},function(t,n){var r={}.hasOwnProperty;t.exports=function(t,n){return r.call(t,n)}},function(t,n){var r=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=r)},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n,r){var e=r(11),i=r(66);t.exports=r(10)?function(t,n,r){return e.f(t,n,i(1,r))}:function(t,n,r){return t[n]=r,t}},function(t,n,r){var e=r(3),i=r(27),o=r(24),u=r(76)("src"),c="toString",f=Function[c],a=(""+f).split(c);r(52).inspectSource=function(t){return f.call(t)},(t.exports=function(t,n,r,c){var f="function"==typeof r;f&&(o(r,"name")||i(r,"name",n)),t[n]!==r&&(f&&(o(r,u)||i(r,u,t[n]?""+t[n]:a.join(String(n)))),t===e?t[n]=r:c?t[n]?t[n]=r:i(t,n,r):(delete t[n],i(t,n,r)))})(Function.prototype,c,function(){return"function"==typeof this&&this[u]||f.call(this)})},function(t,n,r){var e=r(1),i=r(4),o=r(46),u=function(t,n,r,e){var i=String(o(t)),u="<"+n;return""!==r&&(u+=" "+r+'="'+String(e).replace(/"/g,"&quot;")+'"'),u+">"+i+"</"+n+">"};t.exports=function(t,n){var r={};r[t]=n(u),e(e.P+e.F*i(function(){var n=""[t]('"');return n!==n.toLowerCase()||n.split('"').length>3}),"String",r)}},function(t,n,r){var e=r(115),i=r(46);t.exports=function(t){return e(i(t))}},function(t,n,r){var e=r(116),i=r(66),o=r(30),u=r(50),c=r(24),f=r(167),a=Object.getOwnPropertyDescriptor;n.f=r(10)?a:function(t,n){if(t=o(t),n=u(n,!0),f)try{return a(t,n)}catch(t){}if(c(t,n))return i(!e.f.call(t,n),t[n])}},function(t,n,r){var e=r(24),i=r(17),o=r(145)("IE_PROTO"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),e(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,n){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on  "+t);return t}},function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,n){t.exports={}},function(t,n){t.exports=!0},function(t,n){n.f={}.propertyIsEnumerable},function(t,n,r){var e=r(14).f,i=r(8),o=r(15)("toStringTag");t.exports=function(t,n,r){t&&!i(t=r?t:t.prototype,o)&&e(t,o,{configurable:!0,value:n})}},function(t,n,r){var e=r(40)("keys"),i=r(23);t.exports=function(t){return e[t]||(e[t]=i(t))}},function(t,n,r){var e=r(5),i="__core-js_shared__",o=e[i]||(e[i]={});t.exports=function(t){return o[t]||(o[t]={})}},function(t,n){var r=Math.ceil,e=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?e:r)(t)}},function(t,n,r){var e=r(21);t.exports=function(t,n){if(!e(t))return t;var r,i;if(n&&"function"==typeof(r=t.toString)&&!e(i=r.call(t)))return i;if("function"==typeof(r=t.valueOf)&&!e(i=r.call(t)))return i;if(!n&&"function"==typeof(r=t.toString)&&!e(i=r.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,n,r){var e=r(5),i=r(25),o=r(36),u=r(44),c=r(14).f;t.exports=function(t){var n=i.Symbol||(i.Symbol=o?{}:e.Symbol||{});"_"==t.charAt(0)||t in n||c(n,t,{value:u.f(t)})}},function(t,n,r){n.f=r(15)},function(t,n){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,n){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on  "+t);return t}},function(t,n,r){var e=r(4);t.exports=function(t,n){return!!t&&e(function(){n?t.call(null,function(){},1):t.call(null)})}},function(t,n,r){var e=r(53),i=r(115),o=r(17),u=r(16),c=r(203);t.exports=function(t,n){var r=1==t,f=2==t,a=3==t,s=4==t,l=6==t,h=5==t||l,v=n||c;return function(n,c,p){for(var d,y,g=o(n),b=i(g),m=e(c,p,3),x=u(b.length),w=0,S=r?v(n,x):f?v(n,0):void 0;x>w;w++)if((h||w in b)&&(d=b[w],y=m(d,w,g),t))if(r)S[w]=y;else if(y)switch(t){case 3:return!0;case 5:return d;case 6:return w;case 2:S.push(d)}else if(s)return!1;return l?-1:a||s?s:S}}},function(t,n,r){var e=r(1),i=r(52),o=r(4);t.exports=function(t,n){var r=(i.Object||{})[t]||Object[t],u={};u[t]=n(r),e(e.S+e.F*o(function(){r(1)}),"Object",u)}},function(t,n,r){var e=r(6);t.exports=function(t,n){if(!e(t))return t;var r,i;if(n&&"function"==typeof(r=t.toString)&&!e(i=r.call(t)))return i;if("function"==typeof(r=t.valueOf)&&!e(i=r.call(t)))return i;if(!n&&"function"==typeof(r=t.toString)&&!e(i=r.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,n,r){var e=r(5),i=r(25),o=r(91),u=r(13),c="prototype",f=function(t,n,r){var a,s,l,h=t&f.F,v=t&f.G,p=t&f.S,d=t&f.P,y=t&f.B,g=t&f.W,b=v?i:i[n]||(i[n]={}),m=b[c],x=v?e:p?e[n]:(e[n]||{})[c];v&&(r=n);for(a in r)(s=!h&&x&&void 0!==x[a])&&a in b||(l=s?x[a]:r[a],b[a]=v&&"function"!=typeof x[a]?r[a]:y&&s?o(l,e):g&&x[a]==l?function(t){var n=function(n,r,e){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,r)}return new t(n,r,e)}return t.apply(this,arguments)};return n[c]=t[c],n}(l):d&&"function"==typeof l?o(Function.call,l):l,d&&((b.virtual||(b.virtual={}))[a]=l,t&f.R&&m&&!m[a]&&u(m,a,l)))};f.F=1,f.G=2,f.S=4,f.P=8,f.B=16,f.W=32,f.U=64,f.R=128,t.exports=f},function(t,n){var r=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=r)},function(t,n,r){var e=r(26);t.exports=function(t,n,r){if(e(t),void 0===n)return t;switch(r){case 1:return function(r){return t.call(n,r)};case 2:return function(r,e){return t.call(n,r,e)};case 3:return function(r,e,i){return t.call(n,r,e,i)}}return function(){return t.apply(n,arguments)}}},function(t,n,r){var e=r(183),i=r(1),o=r(126)("metadata"),u=o.store||(o.store=new(r(186))),c=function(t,n,r){var i=u.get(t);if(!i){if(!r)return;u.set(t,i=new e)}var o=i.get(n);if(!o){if(!r)return;i.set(n,o=new e)}return o},f=function(t,n,r){var e=c(n,r,!1);return void 0!==e&&e.has(t)},a=function(t,n,r){var e=c(n,r,!1);return void 0===e?void 0:e.get(t)},s=function(t,n,r,e){c(r,e,!0).set(t,n)},l=function(t,n){var r=c(t,n,!1),e=[];return r&&r.forEach(function(t,n){e.push(n)}),e},h=function(t){return void 0===t||"symbol"==typeof t?t:String(t)},v=function(t){i(i.S,"Reflect",t)};t.exports={store:u,map:c,has:f,get:a,set:s,keys:l,key:h,exp:v}},function(t,n,r){"use strict";if(r(10)){var e=r(69),i=r(3),o=r(4),u=r(1),c=r(127),f=r(152),a=r(53),s=r(68),l=r(66),h=r(27),v=r(73),p=r(67),d=r(16),y=r(75),g=r(50),b=r(24),m=r(180),x=r(114),w=r(6),S=r(17),_=r(137),O=r(70),E=r(32),P=r(71).f,j=r(154),F=r(76),M=r(7),A=r(48),N=r(117),T=r(146),I=r(155),k=r(80),L=r(123),R=r(74),C=r(130),D=r(160),U=r(11),W=r(31),G=U.f,B=W.f,V=i.RangeError,z=i.TypeError,q=i.Uint8Array,K="ArrayBuffer",J="Shared"+K,Y="BYTES_PER_ELEMENT",H="prototype",$=Array[H],X=f.ArrayBuffer,Q=f.DataView,Z=A(0),tt=A(2),nt=A(3),rt=A(4),et=A(5),it=A(6),ot=N(!0),ut=N(!1),ct=I.values,ft=I.keys,at=I.entries,st=$.lastIndexOf,lt=$.reduce,ht=$.reduceRight,vt=$.join,pt=$.sort,dt=$.slice,yt=$.toString,gt=$.toLocaleString,bt=M("iterator"),mt=M("toStringTag"),xt=F("typed_constructor"),wt=F("def_constructor"),St=c.CONSTR,_t=c.TYPED,Ot=c.VIEW,Et="Wrong length!",Pt=A(1,function(t,n){return Tt(T(t,t[wt]),n)}),jt=o(function(){return 1===new q(new Uint16Array([1]).buffer)[0]}),Ft=!!q&&!!q[H].set&&o(function(){new q(1).set({})}),Mt=function(t,n){if(void 0===t)throw z(Et);var r=+t,e=d(t);if(n&&!m(r,e))throw V(Et);return e},At=function(t,n){var r=p(t);if(r<0||r%n)throw V("Wrong offset!");return r},Nt=function(t){if(w(t)&&_t in t)return t;throw z(t+" is not a typed array!")},Tt=function(t,n){if(!(w(t)&&xt in t))throw z("It is not a typed array constructor!");return new t(n)},It=function(t,n){return kt(T(t,t[wt]),n)},kt=function(t,n){for(var r=0,e=n.length,i=Tt(t,e);e>r;)i[r]=n[r++];return i},Lt=function(t,n,r){G(t,n,{get:function(){return this._d[r]}})},Rt=function(t){var n,r,e,i,o,u,c=S(t),f=arguments.length,s=f>1?arguments[1]:void 0,l=void 0!==s,h=j(c);if(void 0!=h&&!_(h)){for(u=h.call(c),e=[],n=0;!(o=u.next()).done;n++)e.push(o.value);c=e}for(l&&f>2&&(s=a(s,arguments[2],2)),n=0,r=d(c.length),i=Tt(this,r);r>n;n++)i[n]=l?s(c[n],n):c[n];return i},Ct=function(){for(var t=0,n=arguments.length,r=Tt(this,n);n>t;)r[t]=arguments[t++];return r},Dt=!!q&&o(function(){gt.call(new q(1))}),Ut=function(){return gt.apply(Dt?dt.call(Nt(this)):Nt(this),arguments)},Wt={copyWithin:function(t,n){return D.call(Nt(this),t,n,arguments.length>2?arguments[2]:void 0)},every:function(t){return rt(Nt(this),t,arguments.length>1?arguments[1]:void 0)},fill:function(t){return C.apply(Nt(this),arguments)},filter:function(t){return It(this,tt(Nt(this),t,arguments.length>1?arguments[1]:void 0))},find:function(t){return et(Nt(this),t,arguments.length>1?arguments[1]:void 0)},findIndex:function(t){return it(Nt(this),t,arguments.length>1?arguments[1]:void 0)},forEach:function(t){Z(Nt(this),t,arguments.length>1?arguments[1]:void 0)},indexOf:function(t){return ut(Nt(this),t,arguments.length>1?arguments[1]:void 0)},includes:function(t){return ot(Nt(this),t,arguments.length>1?arguments[1]:void 0)},join:function(t){return vt.apply(Nt(this),arguments)},lastIndexOf:function(t){return st.apply(Nt(this),arguments)},map:function(t){return Pt(Nt(this),t,arguments.length>1?arguments[1]:void 0)},reduce:function(t){return lt.apply(Nt(this),arguments)},reduceRight:function(t){return ht.apply(Nt(this),arguments)},reverse:function(){for(var t,n=this,r=Nt(n).length,e=Math.floor(r/2),i=0;i<e;)t=n[i],n[i++]=n[--r],n[r]=t;return n},some:function(t){return nt(Nt(this),t,arguments.length>1?arguments[1]:void 0)},sort:function(t){return pt.call(Nt(this),t)},subarray:function(t,n){var r=Nt(this),e=r.length,i=y(t,e);return new(T(r,r[wt]))(r.buffer,r.byteOffset+i*r.BYTES_PER_ELEMENT,d((void 0===n?e:y(n,e))-i))}},Gt=function(t,n){return It(this,dt.call(Nt(this),t,n))},Bt=function(t){Nt(this);var n=At(arguments[1],1),r=this.length,e=S(t),i=d(e.length),o=0;if(i+n>r)throw V(Et);for(;o<i;)this[n+o]=e[o++]},Vt={entries:function(){return at.call(Nt(this))},keys:function(){return ft.call(Nt(this))},values:function(){return ct.call(Nt(this))}},zt=function(t,n){return w(t)&&t[_t]&&"symbol"!=typeof n&&n in t&&String(+n)==String(n)},qt=function(t,n){return zt(t,n=g(n,!0))?l(2,t[n]):B(t,n)},Kt=function(t,n,r){return!(zt(t,n=g(n,!0))&&w(r)&&b(r,"value"))||b(r,"get")||b(r,"set")||r.configurable||b(r,"writable")&&!r.writable||b(r,"enumerable")&&!r.enumerable?G(t,n,r):(t[n]=r.value,t)};St||(W.f=qt,U.f=Kt),u(u.S+u.F*!St,"Object",{getOwnPropertyDescriptor:qt,defineProperty:Kt}),o(function(){yt.call({})})&&(yt=gt=function(){return vt.call(this)});var Jt=v({},Wt);v(Jt,Vt),h(Jt,bt,Vt.values),v(Jt,{slice:Gt,set:Bt,constructor:function(){},toString:yt,toLocaleString:Ut}),Lt(Jt,"buffer","b"),Lt(Jt,"byteOffset","o"),Lt(Jt,"byteLength","l"),Lt(Jt,"length","e"),G(Jt,mt,{get:function(){return this[_t]}}),t.exports=function(t,n,r,f){f=!!f;var a=t+(f?"Clamped":"")+"Array",l="Uint8Array"!=a,v="get"+t,p="set"+t,y=i[a],g=y||{},b=y&&E(y),m=!y||!c.ABV,S={},_=y&&y[H],j=function(t,r){var e=t._d;return e.v[v](r*n+e.o,jt)},F=function(t,r,e){var i=t._d;f&&(e=(e=Math.round(e))<0?0:e>255?255:255&e),i.v[p](r*n+i.o,e,jt)},M=function(t,n){G(t,n,{get:function(){return j(this,n)},set:function(t){return F(this,n,t)},enumerable:!0})};m?(y=r(function(t,r,e,i){s(t,y,a,"_d");var o,u,c,f,l=0,v=0;if(w(r)){if(!(r instanceof X||(f=x(r))==K||f==J))return _t in r?kt(y,r):Rt.call(y,r);o=r,v=At(e,n);var p=r.byteLength;if(void 0===i){if(p%n)throw V(Et);if((u=p-v)<0)throw V(Et)}else if((u=d(i)*n)+v>p)throw V(Et);c=u/n}else c=Mt(r,!0),u=c*n,o=new X(u);for(h(t,"_d",{b:o,o:v,l:u,e:c,v:new Q(o)});l<c;)M(t,l++)}),_=y[H]=O(Jt),h(_,"constructor",y)):L(function(t){new y(null),new y(t)},!0)||(y=r(function(t,r,e,i){s(t,y,a);var o;return w(r)?r instanceof X||(o=x(r))==K||o==J?void 0!==i?new g(r,At(e,n),i):void 0!==e?new g(r,At(e,n)):new g(r):_t in r?kt(y,r):Rt.call(y,r):new g(Mt(r,l))}),Z(b!==Function.prototype?P(g).concat(P(b)):P(g),function(t){t in y||h(y,t,g[t])}),y[H]=_,e||(_.constructor=y));var A=_[bt],N=!!A&&("values"==A.name||void 0==A.name),T=Vt.values;h(y,xt,!0),h(_,_t,a),h(_,Ot,!0),h(_,wt,y),(f?new y(1)[mt]==a:mt in _)||G(_,mt,{get:function(){return a}}),S[a]=y,u(u.G+u.W+u.F*(y!=g),S),u(u.S,a,{BYTES_PER_ELEMENT:n,from:Rt,of:Ct}),Y in _||h(_,Y,n),u(u.P,a,Wt),R(a),u(u.P+u.F*Ft,a,{set:Bt}),u(u.P+u.F*!N,a,Vt),u(u.P+u.F*(_.toString!=yt),a,{toString:yt}),u(u.P+u.F*o(function(){new y(1).slice()}),a,{slice:Gt}),u(u.P+u.F*(o(function(){return[1,2].toLocaleString()!=new y([1,2]).toLocaleString()})||!o(function(){_.toLocaleString.call([1,2])})),a,{toLocaleString:Ut}),k[a]=N?A:T,e||N||h(_,bt,T)}}else t.exports=function(){}},function(t,n){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,n,r){var e=r(21),i=r(5).document,o=e(i)&&e(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},function(t,n,r){t.exports=!r(12)&&!r(18)(function(){return 7!=Object.defineProperty(r(57)("div"),"a",{get:function(){return 7}}).a})},function(t,n,r){"use strict";var e=r(36),i=r(51),o=r(64),u=r(13),c=r(8),f=r(35),a=r(96),s=r(38),l=r(103),h=r(15)("iterator"),v=!([].keys&&"next"in[].keys()),p="keys",d="values",y=function(){return this};t.exports=function(t,n,r,g,b,m,x){a(r,n,g);var w,S,_,O=function(t){if(!v&&t in F)return F[t];switch(t){case p:case d:return function(){return new r(this,t)}}return function(){return new r(this,t)}},E=n+" Iterator",P=b==d,j=!1,F=t.prototype,M=F[h]||F["@@iterator"]||b&&F[b],A=M||O(b),N=b?P?O("entries"):A:void 0,T="Array"==n?F.entries||M:M;if(T&&(_=l(T.call(new t)))!==Object.prototype&&(s(_,E,!0),e||c(_,h)||u(_,h,y)),P&&M&&M.name!==d&&(j=!0,A=function(){return M.call(this)}),e&&!x||!v&&!j&&F[h]||u(F,h,A),f[n]=A,f[E]=y,b)if(w={values:P?A:O(d),keys:m?A:O(p),entries:N},x)for(S in w)S in F||o(F,S,w[S]);else i(i.P+i.F*(v||j),n,w);return w}},function(t,n,r){var e=r(20),i=r(100),o=r(34),u=r(39)("IE_PROTO"),c=function(){},f="prototype",a=function(){var t,n=r(57)("iframe"),e=o.length;for(n.style.display="none",r(93).appendChild(n),n.src="javascript:",t=n.contentWindow.document,t.open(),t.write("<script>document.F=Object<\/script>"),t.close(),a=t.F;e--;)delete a[f][o[e]];return a()};t.exports=Object.create||function(t,n){var r;return null!==t?(c[f]=e(t),r=new c,c[f]=null,r[u]=t):r=a(),void 0===n?r:i(r,n)}},function(t,n,r){var e=r(63),i=r(34).concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return e(t,i)}},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n,r){var e=r(8),i=r(9),o=r(90)(!1),u=r(39)("IE_PROTO");t.exports=function(t,n){var r,c=i(t),f=0,a=[];for(r in c)r!=u&&e(c,r)&&a.push(r);for(;n.length>f;)e(c,r=n[f++])&&(~o(a,r)||a.push(r));return a}},function(t,n,r){t.exports=r(13)},function(t,n,r){var e=r(76)("meta"),i=r(6),o=r(24),u=r(11).f,c=0,f=Object.isExtensible||function(){return!0},a=!r(4)(function(){return f(Object.preventExtensions({}))}),s=function(t){u(t,e,{value:{i:"O"+ ++c,w:{}}})},l=function(t,n){if(!i(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!o(t,e)){if(!f(t))return"F";if(!n)return"E";s(t)}return t[e].i},h=function(t,n){if(!o(t,e)){if(!f(t))return!0;if(!n)return!1;s(t)}return t[e].w},v=function(t){return a&&p.NEED&&f(t)&&!o(t,e)&&s(t),t},p=t.exports={KEY:e,NEED:!1,fastKey:l,getWeak:h,onFreeze:v}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n){var r=Math.ceil,e=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?e:r)(t)}},function(t,n){t.exports=function(t,n,r,e){if(!(t instanceof n)||void 0!==e&&e in t)throw TypeError(r+": incorrect invocation!");return t}},function(t,n){t.exports=!1},function(t,n,r){var e=r(2),i=r(173),o=r(133),u=r(145)("IE_PROTO"),c=function(){},f="prototype",a=function(){var t,n=r(132)("iframe"),e=o.length;for(n.style.display="none",r(135).appendChild(n),n.src="javascript:",t=n.contentWindow.document,t.open(),t.write("<script>document.F=Object<\/script>"),t.close(),a=t.F;e--;)delete a[f][o[e]];return a()};t.exports=Object.create||function(t,n){var r;return null!==t?(c[f]=e(t),r=new c,c[f]=null,r[u]=t):r=a(),void 0===n?r:i(r,n)}},function(t,n,r){var e=r(175),i=r(133).concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return e(t,i)}},function(t,n,r){var e=r(175),i=r(133);t.exports=Object.keys||function(t){return e(t,i)}},function(t,n,r){var e=r(28);t.exports=function(t,n,r){for(var i in n)e(t,i,n[i],r);return t}},function(t,n,r){"use strict";var e=r(3),i=r(11),o=r(10),u=r(7)("species");t.exports=function(t){var n=e[t];o&&n&&!n[u]&&i.f(n,u,{configurable:!0,get:function(){return this}})}},function(t,n,r){var e=r(67),i=Math.max,o=Math.min;t.exports=function(t,n){return t=e(t),t<0?i(t+n,0):o(t,n)}},function(t,n){var r=0,e=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+e).toString(36))}},function(t,n,r){var e=r(33);t.exports=function(t){return Object(e(t))}},function(t,n,r){var e=r(7)("unscopables"),i=Array.prototype;void 0==i[e]&&r(27)(i,e,{}),t.exports=function(t){i[e][t]=!0}},function(t,n,r){var e=r(53),i=r(169),o=r(137),u=r(2),c=r(16),f=r(154),a={},s={},n=t.exports=function(t,n,r,l,h){var v,p,d,y,g=h?function(){return t}:f(t),b=e(r,l,n?2:1),m=0;if("function"!=typeof g)throw TypeError(t+" is not iterable!");if(o(g)){for(v=c(t.length);v>m;m++)if((y=n?b(u(p=t[m])[0],p[1]):b(t[m]))===a||y===s)return y}else for(d=g.call(t);!(p=d.next()).done;)if((y=i(d,b,p.value,n))===a||y===s)return y};n.BREAK=a,n.RETURN=s},function(t,n){t.exports={}},function(t,n,r){var e=r(11).f,i=r(24),o=r(7)("toStringTag");t.exports=function(t,n,r){t&&!i(t=r?t:t.prototype,o)&&e(t,o,{configurable:!0,value:n})}},function(t,n,r){var e=r(1),i=r(46),o=r(4),u=r(150),c="["+u+"]",f="​",a=RegExp("^"+c+c+"*"),s=RegExp(c+c+"*$"),l=function(t,n,r){var i={},c=o(function(){return!!u[t]()||f[t]()!=f}),a=i[t]=c?n(h):u[t];r&&(i[r]=a),e(e.P+e.F*c,"String",i)},h=l.trim=function(t,n){return t=String(i(t)),1&n&&(t=t.replace(a,"")),2&n&&(t=t.replace(s,"")),t};t.exports=l},function(t,n,r){t.exports={default:r(86),__esModule:!0}},function(t,n,r){t.exports={default:r(87),__esModule:!0}},function(t,n,r){"use strict";function e(t){return t&&t.__esModule?t:{default:t}}n.__esModule=!0;var i=r(84),o=e(i),u=r(83),c=e(u),f="function"==typeof c.default&&"symbol"==typeof o.default?function(t){return typeof t}:function(t){return t&&"function"==typeof c.default&&t.constructor===c.default&&t!==c.default.prototype?"symbol":typeof t};n.default="function"==typeof c.default&&"symbol"===f(o.default)?function(t){return void 0===t?"undefined":f(t)}:function(t){return t&&"function"==typeof c.default&&t.constructor===c.default&&t!==c.default.prototype?"symbol":void 0===t?"undefined":f(t)}},function(t,n,r){r(110),r(108),r(111),r(112),t.exports=r(25).Symbol},function(t,n,r){r(109),r(113),t.exports=r(44).f("iterator")},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n){t.exports=function(){}},function(t,n,r){var e=r(9),i=r(106),o=r(105);t.exports=function(t){return function(n,r,u){var c,f=e(n),a=i(f.length),s=o(u,a);if(t&&r!=r){for(;a>s;)if((c=f[s++])!=c)return!0}else for(;a>s;s++)if((t||s in f)&&f[s]===r)return t||s||0;return!t&&-1}}},function(t,n,r){var e=r(88);t.exports=function(t,n,r){if(e(t),void 0===n)return t;switch(r){case 1:return function(r){return t.call(n,r)};case 2:return function(r,e){return t.call(n,r,e)};case 3:return function(r,e,i){return t.call(n,r,e,i)}}return function(){return t.apply(n,arguments)}}},function(t,n,r){var e=r(19),i=r(62),o=r(37);t.exports=function(t){var n=e(t),r=i.f;if(r)for(var u,c=r(t),f=o.f,a=0;c.length>a;)f.call(t,u=c[a++])&&n.push(u);return n}},function(t,n,r){t.exports=r(5).document&&document.documentElement},function(t,n,r){var e=r(56);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==e(t)?t.split(""):Object(t)}},function(t,n,r){var e=r(56);t.exports=Array.isArray||function(t){return"Array"==e(t)}},function(t,n,r){"use strict";var e=r(60),i=r(22),o=r(38),u={};r(13)(u,r(15)("iterator"),function(){return this}),t.exports=function(t,n,r){t.prototype=e(u,{next:i(1,r)}),o(t,n+" Iterator")}},function(t,n){t.exports=function(t,n){return{value:n,done:!!t}}},function(t,n,r){var e=r(19),i=r(9);t.exports=function(t,n){for(var r,o=i(t),u=e(o),c=u.length,f=0;c>f;)if(o[r=u[f++]]===n)return r}},function(t,n,r){var e=r(23)("meta"),i=r(21),o=r(8),u=r(14).f,c=0,f=Object.isExtensible||function(){return!0},a=!r(18)(function(){return f(Object.preventExtensions({}))}),s=function(t){u(t,e,{value:{i:"O"+ ++c,w:{}}})},l=function(t,n){if(!i(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!o(t,e)){if(!f(t))return"F";if(!n)return"E";s(t)}return t[e].i},h=function(t,n){if(!o(t,e)){if(!f(t))return!0;if(!n)return!1;s(t)}return t[e].w},v=function(t){return a&&p.NEED&&f(t)&&!o(t,e)&&s(t),t},p=t.exports={KEY:e,NEED:!1,fastKey:l,getWeak:h,onFreeze:v}},function(t,n,r){var e=r(14),i=r(20),o=r(19);t.exports=r(12)?Object.defineProperties:function(t,n){i(t);for(var r,u=o(n),c=u.length,f=0;c>f;)e.f(t,r=u[f++],n[r]);return t}},function(t,n,r){var e=r(37),i=r(22),o=r(9),u=r(42),c=r(8),f=r(58),a=Object.getOwnPropertyDescriptor;n.f=r(12)?a:function(t,n){if(t=o(t),n=u(n,!0),f)try{return a(t,n)}catch(t){}if(c(t,n))return i(!e.f.call(t,n),t[n])}},function(t,n,r){var e=r(9),i=r(61).f,o={}.toString,u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],c=function(t){try{return i(t)}catch(t){return u.slice()}};t.exports.f=function(t){return u&&"[object Window]"==o.call(t)?c(t):i(e(t))}},function(t,n,r){var e=r(8),i=r(77),o=r(39)("IE_PROTO"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),e(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,n,r){var e=r(41),i=r(33);t.exports=function(t){return function(n,r){var o,u,c=String(i(n)),f=e(r),a=c.length;return f<0||f>=a?t?"":void 0:(o=c.charCodeAt(f),o<55296||o>56319||f+1===a||(u=c.charCodeAt(f+1))<56320||u>57343?t?c.charAt(f):o:t?c.slice(f,f+2):u-56320+(o-55296<<10)+65536)}}},function(t,n,r){var e=r(41),i=Math.max,o=Math.min;t.exports=function(t,n){return t=e(t),t<0?i(t+n,0):o(t,n)}},function(t,n,r){var e=r(41),i=Math.min;t.exports=function(t){return t>0?i(e(t),9007199254740991):0}},function(t,n,r){"use strict";var e=r(89),i=r(97),o=r(35),u=r(9);t.exports=r(59)(Array,"Array",function(t,n){this._t=u(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,r=this._i++;return!t||r>=t.length?(this._t=void 0,i(1)):"keys"==n?i(0,r):"values"==n?i(0,t[r]):i(0,[r,t[r]])},"values"),o.Arguments=o.Array,e("keys"),e("values"),e("entries")},function(t,n){},function(t,n,r){"use strict";var e=r(104)(!0);r(59)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,n=this._t,r=this._i;return r>=n.length?{value:void 0,done:!0}:(t=e(n,r),this._i+=t.length,{value:t,done:!1})})},function(t,n,r){"use strict";var e=r(5),i=r(8),o=r(12),u=r(51),c=r(64),f=r(99).KEY,a=r(18),s=r(40),l=r(38),h=r(23),v=r(15),p=r(44),d=r(43),y=r(98),g=r(92),b=r(95),m=r(20),x=r(9),w=r(42),S=r(22),_=r(60),O=r(102),E=r(101),P=r(14),j=r(19),F=E.f,M=P.f,A=O.f,N=e.Symbol,T=e.JSON,I=T&&T.stringify,k="prototype",L=v("_hidden"),R=v("toPrimitive"),C={}.propertyIsEnumerable,D=s("symbol-registry"),U=s("symbols"),W=s("op-symbols"),G=Object[k],B="function"==typeof N,V=e.QObject,z=!V||!V[k]||!V[k].findChild,q=o&&a(function(){return 7!=_(M({},"a",{get:function(){return M(this,"a",{value:7}).a}})).a})?function(t,n,r){var e=F(G,n);e&&delete G[n],M(t,n,r),e&&t!==G&&M(G,n,e)}:M,K=function(t){var n=U[t]=_(N[k]);return n._k=t,n},J=B&&"symbol"==typeof N.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof N},Y=function(t,n,r){return t===G&&Y(W,n,r),m(t),n=w(n,!0),m(r),i(U,n)?(r.enumerable?(i(t,L)&&t[L][n]&&(t[L][n]=!1),r=_(r,{enumerable:S(0,!1)})):(i(t,L)||M(t,L,S(1,{})),t[L][n]=!0),q(t,n,r)):M(t,n,r)},H=function(t,n){m(t);for(var r,e=g(n=x(n)),i=0,o=e.length;o>i;)Y(t,r=e[i++],n[r]);return t},$=function(t,n){return void 0===n?_(t):H(_(t),n)},X=function(t){var n=C.call(this,t=w(t,!0));return!(this===G&&i(U,t)&&!i(W,t))&&(!(n||!i(this,t)||!i(U,t)||i(this,L)&&this[L][t])||n)},Q=function(t,n){if(t=x(t),n=w(n,!0),t!==G||!i(U,n)||i(W,n)){var r=F(t,n);return!r||!i(U,n)||i(t,L)&&t[L][n]||(r.enumerable=!0),r}},Z=function(t){for(var n,r=A(x(t)),e=[],o=0;r.length>o;)i(U,n=r[o++])||n==L||n==f||e.push(n);return e},tt=function(t){for(var n,r=t===G,e=A(r?W:x(t)),o=[],u=0;e.length>u;)!i(U,n=e[u++])||r&&!i(G,n)||o.push(U[n]);return o};B||(N=function(){if(this instanceof N)throw TypeError("Symbol is not a constructor!");var t=h(arguments.length>0?arguments[0]:void 0),n=function(r){this===G&&n.call(W,r),i(this,L)&&i(this[L],t)&&(this[L][t]=!1),q(this,t,S(1,r))};return o&&z&&q(G,t,{configurable:!0,set:n}),K(t)},c(N[k],"toString",function(){return this._k}),E.f=Q,P.f=Y,r(61).f=O.f=Z,r(37).f=X,r(62).f=tt,o&&!r(36)&&c(G,"propertyIsEnumerable",X,!0),p.f=function(t){return K(v(t))}),u(u.G+u.W+u.F*!B,{Symbol:N});for(var nt="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),rt=0;nt.length>rt;)v(nt[rt++]);for(var nt=j(v.store),rt=0;nt.length>rt;)d(nt[rt++]);u(u.S+u.F*!B,"Symbol",{for:function(t){return i(D,t+="")?D[t]:D[t]=N(t)},keyFor:function(t){if(J(t))return y(D,t);throw TypeError(t+" is not a symbol!")},useSetter:function(){z=!0},useSimple:function(){z=!1}}),u(u.S+u.F*!B,"Object",{create:$,defineProperty:Y,defineProperties:H,getOwnPropertyDescriptor:Q,getOwnPropertyNames:Z,getOwnPropertySymbols:tt}),T&&u(u.S+u.F*(!B||a(function(){var t=N();return"[null]"!=I([t])||"{}"!=I({a:t})||"{}"!=I(Object(t))})),"JSON",{stringify:function(t){if(void 0!==t&&!J(t)){for(var n,r,e=[t],i=1;arguments.length>i;)e.push(arguments[i++]);return n=e[1],"function"==typeof n&&(r=n),!r&&b(n)||(n=function(t,n){if(r&&(n=r.call(this,t,n)),!J(n))return n}),e[1]=n,I.apply(T,e)}}}),N[k][R]||r(13)(N[k],R,N[k].valueOf),l(N,"Symbol"),l(Math,"Math",!0),l(e.JSON,"JSON",!0)},function(t,n,r){r(43)("asyncIterator")},function(t,n,r){r(43)("observable")},function(t,n,r){r(107);for(var e=r(5),i=r(13),o=r(35),u=r(15)("toStringTag"),c=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],f=0;f<5;f++){var a=c[f],s=e[a],l=s&&s.prototype;l&&!l[u]&&i(l,u,a),o[a]=o.Array}},function(t,n,r){var e=r(45),i=r(7)("toStringTag"),o="Arguments"==e(function(){return arguments}()),u=function(t,n){try{return t[n]}catch(t){}};t.exports=function(t){var n,r,c;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=u(n=Object(t),i))?r:o?e(n):"Object"==(c=e(n))&&"function"==typeof n.callee?"Arguments":c}},function(t,n,r){var e=r(45);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==e(t)?t.split(""):Object(t)}},function(t,n){n.f={}.propertyIsEnumerable},function(t,n,r){var e=r(30),i=r(16),o=r(75);t.exports=function(t){return function(n,r,u){var c,f=e(n),a=i(f.length),s=o(u,a);if(t&&r!=r){for(;a>s;)if((c=f[s++])!=c)return!0}else for(;a>s;s++)if((t||s in f)&&f[s]===r)return t||s||0;return!t&&-1}}},function(t,n,r){"use strict";var e=r(3),i=r(1),o=r(28),u=r(73),c=r(65),f=r(79),a=r(68),s=r(6),l=r(4),h=r(123),v=r(81),p=r(136);t.exports=function(t,n,r,d,y,g){var b=e[t],m=b,x=y?"set":"add",w=m&&m.prototype,S={},_=function(t){var n=w[t];o(w,t,"delete"==t?function(t){return!(g&&!s(t))&&n.call(this,0===t?0:t)}:"has"==t?function(t){return!(g&&!s(t))&&n.call(this,0===t?0:t)}:"get"==t?function(t){return g&&!s(t)?void 0:n.call(this,0===t?0:t)}:"add"==t?function(t){return n.call(this,0===t?0:t),this}:function(t,r){return n.call(this,0===t?0:t,r),this})};if("function"==typeof m&&(g||w.forEach&&!l(function(){(new m).entries().next()}))){var O=new m,E=O[x](g?{}:-0,1)!=O,P=l(function(){O.has(1)}),j=h(function(t){new m(t)}),F=!g&&l(function(){for(var t=new m,n=5;n--;)t[x](n,n);return!t.has(-0)});j||(m=n(function(n,r){a(n,m,t);var e=p(new b,n,m);return void 0!=r&&f(r,y,e[x],e),e}),m.prototype=w,w.constructor=m),(P||F)&&(_("delete"),_("has"),y&&_("get")),(F||E)&&_(x),g&&w.clear&&delete w.clear}else m=d.getConstructor(n,t,y,x),u(m.prototype,r),c.NEED=!0;return v(m,t),S[t]=m,i(i.G+i.W+i.F*(m!=b),S),g||d.setStrong(m,t,y),m}},function(t,n,r){"use strict";var e=r(27),i=r(28),o=r(4),u=r(46),c=r(7);t.exports=function(t,n,r){var f=c(t),a=r(u,f,""[t]),s=a[0],l=a[1];o(function(){var n={};return n[f]=function(){return 7},7!=""[t](n)})&&(i(String.prototype,t,s),e(RegExp.prototype,f,2==n?function(t,n){return l.call(t,this,n)}:function(t){return l.call(t,this)}))}
},function(t,n,r){"use strict";var e=r(2);t.exports=function(){var t=e(this),n="";return t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.unicode&&(n+="u"),t.sticky&&(n+="y"),n}},function(t,n){t.exports=function(t,n,r){var e=void 0===r;switch(n.length){case 0:return e?t():t.call(r);case 1:return e?t(n[0]):t.call(r,n[0]);case 2:return e?t(n[0],n[1]):t.call(r,n[0],n[1]);case 3:return e?t(n[0],n[1],n[2]):t.call(r,n[0],n[1],n[2]);case 4:return e?t(n[0],n[1],n[2],n[3]):t.call(r,n[0],n[1],n[2],n[3])}return t.apply(r,n)}},function(t,n,r){var e=r(6),i=r(45),o=r(7)("match");t.exports=function(t){var n;return e(t)&&(void 0!==(n=t[o])?!!n:"RegExp"==i(t))}},function(t,n,r){var e=r(7)("iterator"),i=!1;try{var o=[7][e]();o.return=function(){i=!0},Array.from(o,function(){throw 2})}catch(t){}t.exports=function(t,n){if(!n&&!i)return!1;var r=!1;try{var o=[7],u=o[e]();u.next=function(){return{done:r=!0}},o[e]=function(){return u},t(o)}catch(t){}return r}},function(t,n,r){t.exports=r(69)||!r(4)(function(){var t=Math.random();__defineSetter__.call(null,t,function(){}),delete r(3)[t]})},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n,r){var e=r(3),i="__core-js_shared__",o=e[i]||(e[i]={});t.exports=function(t){return o[t]||(o[t]={})}},function(t,n,r){for(var e,i=r(3),o=r(27),u=r(76),c=u("typed_array"),f=u("view"),a=!(!i.ArrayBuffer||!i.DataView),s=a,l=0,h="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");l<9;)(e=i[h[l++]])?(o(e.prototype,c,!0),o(e.prototype,f,!0)):s=!1;t.exports={ABV:a,CONSTR:s,TYPED:c,VIEW:f}},function(t,n){"use strict";var r={versions:function(){var t=window.navigator.userAgent;return{trident:t.indexOf("Trident")>-1,presto:t.indexOf("Presto")>-1,webKit:t.indexOf("AppleWebKit")>-1,gecko:t.indexOf("Gecko")>-1&&-1==t.indexOf("KHTML"),mobile:!!t.match(/AppleWebKit.*Mobile.*/),ios:!!t.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),android:t.indexOf("Android")>-1||t.indexOf("Linux")>-1,iPhone:t.indexOf("iPhone")>-1||t.indexOf("Mac")>-1,iPad:t.indexOf("iPad")>-1,webApp:-1==t.indexOf("Safari"),weixin:-1==t.indexOf("MicroMessenger")}}()};t.exports=r},function(t,n,r){"use strict";var e=r(85),i=function(t){return t&&t.__esModule?t:{default:t}}(e),o=function(){function t(t,n,e){return n||e?String.fromCharCode(n||e):r[t]||t}function n(t){return e[t]}var r={"&quot;":'"',"&lt;":"<","&gt;":">","&amp;":"&","&nbsp;":" "},e={};for(var u in r)e[r[u]]=u;return r["&apos;"]="'",e["'"]="&#39;",{encode:function(t){return t?(""+t).replace(/['<> "&]/g,n).replace(/\r?\n/g,"<br/>").replace(/\s/g,"&nbsp;"):""},decode:function(n){return n?(""+n).replace(/<br\s*\/?>/gi,"\n").replace(/&quot;|&lt;|&gt;|&amp;|&nbsp;|&apos;|&#(\d+);|&#(\d+)/g,t).replace(/\u00a0/g," "):""},encodeBase16:function(t){if(!t)return t;t+="";for(var n=[],r=0,e=t.length;e>r;r++)n.push(t.charCodeAt(r).toString(16).toUpperCase());return n.join("")},encodeBase16forJSON:function(t){if(!t)return t;t=t.replace(/[\u4E00-\u9FBF]/gi,function(t){return escape(t).replace("%u","\\u")});for(var n=[],r=0,e=t.length;e>r;r++)n.push(t.charCodeAt(r).toString(16).toUpperCase());return n.join("")},decodeBase16:function(t){if(!t)return t;t+="";for(var n=[],r=0,e=t.length;e>r;r+=2)n.push(String.fromCharCode("0x"+t.slice(r,r+2)));return n.join("")},encodeObject:function(t){if(t instanceof Array)for(var n=0,r=t.length;r>n;n++)t[n]=o.encodeObject(t[n]);else if("object"==(void 0===t?"undefined":(0,i.default)(t)))for(var e in t)t[e]=o.encodeObject(t[e]);else if("string"==typeof t)return o.encode(t);return t},loadScript:function(t){var n=document.createElement("script");document.getElementsByTagName("body")[0].appendChild(n),n.setAttribute("src",t)},addLoadEvent:function(t){var n=window.onload;"function"!=typeof window.onload?window.onload=t:window.onload=function(){n(),t()}}}}();t.exports=o},function(t,n,r){"use strict";var e=r(17),i=r(75),o=r(16);t.exports=function(t){for(var n=e(this),r=o(n.length),u=arguments.length,c=i(u>1?arguments[1]:void 0,r),f=u>2?arguments[2]:void 0,a=void 0===f?r:i(f,r);a>c;)n[c++]=t;return n}},function(t,n,r){"use strict";var e=r(11),i=r(66);t.exports=function(t,n,r){n in t?e.f(t,n,i(0,r)):t[n]=r}},function(t,n,r){var e=r(6),i=r(3).document,o=e(i)&&e(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,n,r){var e=r(7)("match");t.exports=function(t){var n=/./;try{"/./"[t](n)}catch(r){try{return n[e]=!1,!"/./"[t](n)}catch(t){}}return!0}},function(t,n,r){t.exports=r(3).document&&document.documentElement},function(t,n,r){var e=r(6),i=r(144).set;t.exports=function(t,n,r){var o,u=n.constructor;return u!==r&&"function"==typeof u&&(o=u.prototype)!==r.prototype&&e(o)&&i&&i(t,o),t}},function(t,n,r){var e=r(80),i=r(7)("iterator"),o=Array.prototype;t.exports=function(t){return void 0!==t&&(e.Array===t||o[i]===t)}},function(t,n,r){var e=r(45);t.exports=Array.isArray||function(t){return"Array"==e(t)}},function(t,n,r){"use strict";var e=r(70),i=r(66),o=r(81),u={};r(27)(u,r(7)("iterator"),function(){return this}),t.exports=function(t,n,r){t.prototype=e(u,{next:i(1,r)}),o(t,n+" Iterator")}},function(t,n,r){"use strict";var e=r(69),i=r(1),o=r(28),u=r(27),c=r(24),f=r(80),a=r(139),s=r(81),l=r(32),h=r(7)("iterator"),v=!([].keys&&"next"in[].keys()),p="keys",d="values",y=function(){return this};t.exports=function(t,n,r,g,b,m,x){a(r,n,g);var w,S,_,O=function(t){if(!v&&t in F)return F[t];switch(t){case p:case d:return function(){return new r(this,t)}}return function(){return new r(this,t)}},E=n+" Iterator",P=b==d,j=!1,F=t.prototype,M=F[h]||F["@@iterator"]||b&&F[b],A=M||O(b),N=b?P?O("entries"):A:void 0,T="Array"==n?F.entries||M:M;if(T&&(_=l(T.call(new t)))!==Object.prototype&&(s(_,E,!0),e||c(_,h)||u(_,h,y)),P&&M&&M.name!==d&&(j=!0,A=function(){return M.call(this)}),e&&!x||!v&&!j&&F[h]||u(F,h,A),f[n]=A,f[E]=y,b)if(w={values:P?A:O(d),keys:m?A:O(p),entries:N},x)for(S in w)S in F||o(F,S,w[S]);else i(i.P+i.F*(v||j),n,w);return w}},function(t,n){var r=Math.expm1;t.exports=!r||r(10)>22025.465794806718||r(10)<22025.465794806718||-2e-17!=r(-2e-17)?function(t){return 0==(t=+t)?t:t>-1e-6&&t<1e-6?t+t*t/2:Math.exp(t)-1}:r},function(t,n){t.exports=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1}},function(t,n,r){var e=r(3),i=r(151).set,o=e.MutationObserver||e.WebKitMutationObserver,u=e.process,c=e.Promise,f="process"==r(45)(u);t.exports=function(){var t,n,r,a=function(){var e,i;for(f&&(e=u.domain)&&e.exit();t;){i=t.fn,t=t.next;try{i()}catch(e){throw t?r():n=void 0,e}}n=void 0,e&&e.enter()};if(f)r=function(){u.nextTick(a)};else if(o){var s=!0,l=document.createTextNode("");new o(a).observe(l,{characterData:!0}),r=function(){l.data=s=!s}}else if(c&&c.resolve){var h=c.resolve();r=function(){h.then(a)}}else r=function(){i.call(e,a)};return function(e){var i={fn:e,next:void 0};n&&(n.next=i),t||(t=i,r()),n=i}}},function(t,n,r){var e=r(6),i=r(2),o=function(t,n){if(i(t),!e(n)&&null!==n)throw TypeError(n+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,n,e){try{e=r(53)(Function.call,r(31).f(Object.prototype,"__proto__").set,2),e(t,[]),n=!(t instanceof Array)}catch(t){n=!0}return function(t,r){return o(t,r),n?t.__proto__=r:e(t,r),t}}({},!1):void 0),check:o}},function(t,n,r){var e=r(126)("keys"),i=r(76);t.exports=function(t){return e[t]||(e[t]=i(t))}},function(t,n,r){var e=r(2),i=r(26),o=r(7)("species");t.exports=function(t,n){var r,u=e(t).constructor;return void 0===u||void 0==(r=e(u)[o])?n:i(r)}},function(t,n,r){var e=r(67),i=r(46);t.exports=function(t){return function(n,r){var o,u,c=String(i(n)),f=e(r),a=c.length;return f<0||f>=a?t?"":void 0:(o=c.charCodeAt(f),o<55296||o>56319||f+1===a||(u=c.charCodeAt(f+1))<56320||u>57343?t?c.charAt(f):o:t?c.slice(f,f+2):u-56320+(o-55296<<10)+65536)}}},function(t,n,r){var e=r(122),i=r(46);t.exports=function(t,n,r){if(e(n))throw TypeError("String#"+r+" doesn't accept regex!");return String(i(t))}},function(t,n,r){"use strict";var e=r(67),i=r(46);t.exports=function(t){var n=String(i(this)),r="",o=e(t);if(o<0||o==1/0)throw RangeError("Count can't be negative");for(;o>0;(o>>>=1)&&(n+=n))1&o&&(r+=n);return r}},function(t,n){t.exports="\t\n\v\f\r   ᠎             　\u2028\u2029\ufeff"},function(t,n,r){var e,i,o,u=r(53),c=r(121),f=r(135),a=r(132),s=r(3),l=s.process,h=s.setImmediate,v=s.clearImmediate,p=s.MessageChannel,d=0,y={},g="onreadystatechange",b=function(){var t=+this;if(y.hasOwnProperty(t)){var n=y[t];delete y[t],n()}},m=function(t){b.call(t.data)};h&&v||(h=function(t){for(var n=[],r=1;arguments.length>r;)n.push(arguments[r++]);return y[++d]=function(){c("function"==typeof t?t:Function(t),n)},e(d),d},v=function(t){delete y[t]},"process"==r(45)(l)?e=function(t){l.nextTick(u(b,t,1))}:p?(i=new p,o=i.port2,i.port1.onmessage=m,e=u(o.postMessage,o,1)):s.addEventListener&&"function"==typeof postMessage&&!s.importScripts?(e=function(t){s.postMessage(t+"","*")},s.addEventListener("message",m,!1)):e=g in a("script")?function(t){f.appendChild(a("script"))[g]=function(){f.removeChild(this),b.call(t)}}:function(t){setTimeout(u(b,t,1),0)}),t.exports={set:h,clear:v}},function(t,n,r){"use strict";var e=r(3),i=r(10),o=r(69),u=r(127),c=r(27),f=r(73),a=r(4),s=r(68),l=r(67),h=r(16),v=r(71).f,p=r(11).f,d=r(130),y=r(81),g="ArrayBuffer",b="DataView",m="prototype",x="Wrong length!",w="Wrong index!",S=e[g],_=e[b],O=e.Math,E=e.RangeError,P=e.Infinity,j=S,F=O.abs,M=O.pow,A=O.floor,N=O.log,T=O.LN2,I="buffer",k="byteLength",L="byteOffset",R=i?"_b":I,C=i?"_l":k,D=i?"_o":L,U=function(t,n,r){var e,i,o,u=Array(r),c=8*r-n-1,f=(1<<c)-1,a=f>>1,s=23===n?M(2,-24)-M(2,-77):0,l=0,h=t<0||0===t&&1/t<0?1:0;for(t=F(t),t!=t||t===P?(i=t!=t?1:0,e=f):(e=A(N(t)/T),t*(o=M(2,-e))<1&&(e--,o*=2),t+=e+a>=1?s/o:s*M(2,1-a),t*o>=2&&(e++,o/=2),e+a>=f?(i=0,e=f):e+a>=1?(i=(t*o-1)*M(2,n),e+=a):(i=t*M(2,a-1)*M(2,n),e=0));n>=8;u[l++]=255&i,i/=256,n-=8);for(e=e<<n|i,c+=n;c>0;u[l++]=255&e,e/=256,c-=8);return u[--l]|=128*h,u},W=function(t,n,r){var e,i=8*r-n-1,o=(1<<i)-1,u=o>>1,c=i-7,f=r-1,a=t[f--],s=127&a;for(a>>=7;c>0;s=256*s+t[f],f--,c-=8);for(e=s&(1<<-c)-1,s>>=-c,c+=n;c>0;e=256*e+t[f],f--,c-=8);if(0===s)s=1-u;else{if(s===o)return e?NaN:a?-P:P;e+=M(2,n),s-=u}return(a?-1:1)*e*M(2,s-n)},G=function(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]},B=function(t){return[255&t]},V=function(t){return[255&t,t>>8&255]},z=function(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]},q=function(t){return U(t,52,8)},K=function(t){return U(t,23,4)},J=function(t,n,r){p(t[m],n,{get:function(){return this[r]}})},Y=function(t,n,r,e){var i=+r,o=l(i);if(i!=o||o<0||o+n>t[C])throw E(w);var u=t[R]._b,c=o+t[D],f=u.slice(c,c+n);return e?f:f.reverse()},H=function(t,n,r,e,i,o){var u=+r,c=l(u);if(u!=c||c<0||c+n>t[C])throw E(w);for(var f=t[R]._b,a=c+t[D],s=e(+i),h=0;h<n;h++)f[a+h]=s[o?h:n-h-1]},$=function(t,n){s(t,S,g);var r=+n,e=h(r);if(r!=e)throw E(x);return e};if(u.ABV){if(!a(function(){new S})||!a(function(){new S(.5)})){S=function(t){return new j($(this,t))};for(var X,Q=S[m]=j[m],Z=v(j),tt=0;Z.length>tt;)(X=Z[tt++])in S||c(S,X,j[X]);o||(Q.constructor=S)}var nt=new _(new S(2)),rt=_[m].setInt8;nt.setInt8(0,2147483648),nt.setInt8(1,2147483649),!nt.getInt8(0)&&nt.getInt8(1)||f(_[m],{setInt8:function(t,n){rt.call(this,t,n<<24>>24)},setUint8:function(t,n){rt.call(this,t,n<<24>>24)}},!0)}else S=function(t){var n=$(this,t);this._b=d.call(Array(n),0),this[C]=n},_=function(t,n,r){s(this,_,b),s(t,S,b);var e=t[C],i=l(n);if(i<0||i>e)throw E("Wrong offset!");if(r=void 0===r?e-i:h(r),i+r>e)throw E(x);this[R]=t,this[D]=i,this[C]=r},i&&(J(S,k,"_l"),J(_,I,"_b"),J(_,k,"_l"),J(_,L,"_o")),f(_[m],{getInt8:function(t){return Y(this,1,t)[0]<<24>>24},getUint8:function(t){return Y(this,1,t)[0]},getInt16:function(t){var n=Y(this,2,t,arguments[1]);return(n[1]<<8|n[0])<<16>>16},getUint16:function(t){var n=Y(this,2,t,arguments[1]);return n[1]<<8|n[0]},getInt32:function(t){return G(Y(this,4,t,arguments[1]))},getUint32:function(t){return G(Y(this,4,t,arguments[1]))>>>0},getFloat32:function(t){return W(Y(this,4,t,arguments[1]),23,4)},getFloat64:function(t){return W(Y(this,8,t,arguments[1]),52,8)},setInt8:function(t,n){H(this,1,t,B,n)},setUint8:function(t,n){H(this,1,t,B,n)},setInt16:function(t,n){H(this,2,t,V,n,arguments[2])},setUint16:function(t,n){H(this,2,t,V,n,arguments[2])},setInt32:function(t,n){H(this,4,t,z,n,arguments[2])},setUint32:function(t,n){H(this,4,t,z,n,arguments[2])},setFloat32:function(t,n){H(this,4,t,K,n,arguments[2])},setFloat64:function(t,n){H(this,8,t,q,n,arguments[2])}});y(S,g),y(_,b),c(_[m],u.VIEW,!0),n[g]=S,n[b]=_},function(t,n,r){var e=r(3),i=r(52),o=r(69),u=r(182),c=r(11).f;t.exports=function(t){var n=i.Symbol||(i.Symbol=o?{}:e.Symbol||{});"_"==t.charAt(0)||t in n||c(n,t,{value:u.f(t)})}},function(t,n,r){var e=r(114),i=r(7)("iterator"),o=r(80);t.exports=r(52).getIteratorMethod=function(t){if(void 0!=t)return t[i]||t["@@iterator"]||o[e(t)]}},function(t,n,r){"use strict";var e=r(78),i=r(170),o=r(80),u=r(30);t.exports=r(140)(Array,"Array",function(t,n){this._t=u(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,r=this._i++;return!t||r>=t.length?(this._t=void 0,i(1)):"keys"==n?i(0,r):"values"==n?i(0,t[r]):i(0,[r,t[r]])},"values"),o.Arguments=o.Array,e("keys"),e("values"),e("entries")},function(t,n){function r(t,n){t.classList?t.classList.add(n):t.className+=" "+n}t.exports=r},function(t,n){function r(t,n){if(t.classList)t.classList.remove(n);else{var r=new RegExp("(^|\\b)"+n.split(" ").join("|")+"(\\b|$)","gi");t.className=t.className.replace(r," ")}}t.exports=r},function(t,n){function r(){throw new Error("setTimeout has not been defined")}function e(){throw new Error("clearTimeout has not been defined")}function i(t){if(s===setTimeout)return setTimeout(t,0);if((s===r||!s)&&setTimeout)return s=setTimeout,setTimeout(t,0);try{return s(t,0)}catch(n){try{return s.call(null,t,0)}catch(n){return s.call(this,t,0)}}}function o(t){if(l===clearTimeout)return clearTimeout(t);if((l===e||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(t);try{return l(t)}catch(n){try{return l.call(null,t)}catch(n){return l.call(this,t)}}}function u(){d&&v&&(d=!1,v.length?p=v.concat(p):y=-1,p.length&&c())}function c(){if(!d){var t=i(u);d=!0;for(var n=p.length;n;){for(v=p,p=[];++y<n;)v&&v[y].run();y=-1,n=p.length}v=null,d=!1,o(t)}}function f(t,n){this.fun=t,this.array=n}function a(){}var s,l,h=t.exports={};!function(){try{s="function"==typeof setTimeout?setTimeout:r}catch(t){s=r}try{l="function"==typeof clearTimeout?clearTimeout:e}catch(t){l=e}}();var v,p=[],d=!1,y=-1;h.nextTick=function(t){var n=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)n[r-1]=arguments[r];p.push(new f(t,n)),1!==p.length||d||i(c)},f.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=a,h.addListener=a,h.once=a,h.off=a,h.removeListener=a,h.removeAllListeners=a,h.emit=a,h.prependListener=a,h.prependOnceListener=a,h.listeners=function(t){return[]},h.binding=function(t){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(t){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},function(t,n,r){var e=r(45);t.exports=function(t,n){if("number"!=typeof t&&"Number"!=e(t))throw TypeError(n);return+t}},function(t,n,r){"use strict";var e=r(17),i=r(75),o=r(16);t.exports=[].copyWithin||function(t,n){var r=e(this),u=o(r.length),c=i(t,u),f=i(n,u),a=arguments.length>2?arguments[2]:void 0,s=Math.min((void 0===a?u:i(a,u))-f,u-c),l=1;for(f<c&&c<f+s&&(l=-1,f+=s-1,c+=s-1);s-- >0;)f in r?r[c]=r[f]:delete r[c],c+=l,f+=l;return r}},function(t,n,r){var e=r(79);t.exports=function(t,n){var r=[];return e(t,!1,r.push,r,n),r}},function(t,n,r){var e=r(26),i=r(17),o=r(115),u=r(16);t.exports=function(t,n,r,c,f){e(n);var a=i(t),s=o(a),l=u(a.length),h=f?l-1:0,v=f?-1:1;if(r<2)for(;;){if(h in s){c=s[h],h+=v;break}if(h+=v,f?h<0:l<=h)throw TypeError("Reduce of empty array with no initial value")}for(;f?h>=0:l>h;h+=v)h in s&&(c=n(c,s[h],h,a));return c}},function(t,n,r){"use strict";var e=r(26),i=r(6),o=r(121),u=[].slice,c={},f=function(t,n,r){if(!(n in c)){for(var e=[],i=0;i<n;i++)e[i]="a["+i+"]";c[n]=Function("F,a","return new F("+e.join(",")+")")}return c[n](t,r)};t.exports=Function.bind||function(t){var n=e(this),r=u.call(arguments,1),c=function(){var e=r.concat(u.call(arguments));return this instanceof c?f(n,e.length,e):o(n,e,t)};return i(n.prototype)&&(c.prototype=n.prototype),c}},function(t,n,r){"use strict";var e=r(11).f,i=r(70),o=r(73),u=r(53),c=r(68),f=r(46),a=r(79),s=r(140),l=r(170),h=r(74),v=r(10),p=r(65).fastKey,d=v?"_s":"size",y=function(t,n){var r,e=p(n);if("F"!==e)return t._i[e];for(r=t._f;r;r=r.n)if(r.k==n)return r};t.exports={getConstructor:function(t,n,r,s){var l=t(function(t,e){c(t,l,n,"_i"),t._i=i(null),t._f=void 0,t._l=void 0,t[d]=0,void 0!=e&&a(e,r,t[s],t)});return o(l.prototype,{clear:function(){for(var t=this,n=t._i,r=t._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete n[r.i];t._f=t._l=void 0,t[d]=0},delete:function(t){var n=this,r=y(n,t);if(r){var e=r.n,i=r.p;delete n._i[r.i],r.r=!0,i&&(i.n=e),e&&(e.p=i),n._f==r&&(n._f=e),n._l==r&&(n._l=i),n[d]--}return!!r},forEach:function(t){c(this,l,"forEach");for(var n,r=u(t,arguments.length>1?arguments[1]:void 0,3);n=n?n.n:this._f;)for(r(n.v,n.k,this);n&&n.r;)n=n.p},has:function(t){return!!y(this,t)}}),v&&e(l.prototype,"size",{get:function(){return f(this[d])}}),l},def:function(t,n,r){var e,i,o=y(t,n);return o?o.v=r:(t._l=o={i:i=p(n,!0),k:n,v:r,p:e=t._l,n:void 0,r:!1},t._f||(t._f=o),e&&(e.n=o),t[d]++,"F"!==i&&(t._i[i]=o)),t},getEntry:y,setStrong:function(t,n,r){s(t,n,function(t,n){this._t=t,this._k=n,this._l=void 0},function(){for(var t=this,n=t._k,r=t._l;r&&r.r;)r=r.p;return t._t&&(t._l=r=r?r.n:t._t._f)?"keys"==n?l(0,r.k):"values"==n?l(0,r.v):l(0,[r.k,r.v]):(t._t=void 0,l(1))},r?"entries":"values",!r,!0),h(n)}}},function(t,n,r){var e=r(114),i=r(161);t.exports=function(t){return function(){if(e(this)!=t)throw TypeError(t+"#toJSON isn't generic");return i(this)}}},function(t,n,r){"use strict";var e=r(73),i=r(65).getWeak,o=r(2),u=r(6),c=r(68),f=r(79),a=r(48),s=r(24),l=a(5),h=a(6),v=0,p=function(t){return t._l||(t._l=new d)},d=function(){this.a=[]},y=function(t,n){return l(t.a,function(t){return t[0]===n})};d.prototype={get:function(t){var n=y(this,t);if(n)return n[1]},has:function(t){return!!y(this,t)},set:function(t,n){var r=y(this,t);r?r[1]=n:this.a.push([t,n])},delete:function(t){var n=h(this.a,function(n){return n[0]===t});return~n&&this.a.splice(n,1),!!~n}},t.exports={getConstructor:function(t,n,r,o){var a=t(function(t,e){c(t,a,n,"_i"),t._i=v++,t._l=void 0,void 0!=e&&f(e,r,t[o],t)});return e(a.prototype,{delete:function(t){if(!u(t))return!1;var n=i(t);return!0===n?p(this).delete(t):n&&s(n,this._i)&&delete n[this._i]},has:function(t){if(!u(t))return!1;var n=i(t);return!0===n?p(this).has(t):n&&s(n,this._i)}}),a},def:function(t,n,r){var e=i(o(n),!0);return!0===e?p(t).set(n,r):e[t._i]=r,t},ufstore:p}},function(t,n,r){t.exports=!r(10)&&!r(4)(function(){return 7!=Object.defineProperty(r(132)("div"),"a",{get:function(){return 7}}).a})},function(t,n,r){var e=r(6),i=Math.floor;t.exports=function(t){return!e(t)&&isFinite(t)&&i(t)===t}},function(t,n,r){var e=r(2);t.exports=function(t,n,r,i){try{return i?n(e(r)[0],r[1]):n(r)}catch(n){var o=t.return;throw void 0!==o&&e(o.call(t)),n}}},function(t,n){t.exports=function(t,n){return{value:n,done:!!t}}},function(t,n){t.exports=Math.log1p||function(t){return(t=+t)>-1e-8&&t<1e-8?t-t*t/2:Math.log(1+t)}},function(t,n,r){"use strict";var e=r(72),i=r(125),o=r(116),u=r(17),c=r(115),f=Object.assign;t.exports=!f||r(4)(function(){var t={},n={},r=Symbol(),e="abcdefghijklmnopqrst";return t[r]=7,e.split("").forEach(function(t){n[t]=t}),7!=f({},t)[r]||Object.keys(f({},n)).join("")!=e})?function(t,n){for(var r=u(t),f=arguments.length,a=1,s=i.f,l=o.f;f>a;)for(var h,v=c(arguments[a++]),p=s?e(v).concat(s(v)):e(v),d=p.length,y=0;d>y;)l.call(v,h=p[y++])&&(r[h]=v[h]);return r}:f},function(t,n,r){var e=r(11),i=r(2),o=r(72);t.exports=r(10)?Object.defineProperties:function(t,n){i(t);for(var r,u=o(n),c=u.length,f=0;c>f;)e.f(t,r=u[f++],n[r]);return t}},function(t,n,r){var e=r(30),i=r(71).f,o={}.toString,u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],c=function(t){try{return i(t)}catch(t){return u.slice()}};t.exports.f=function(t){return u&&"[object Window]"==o.call(t)?c(t):i(e(t))}},function(t,n,r){var e=r(24),i=r(30),o=r(117)(!1),u=r(145)("IE_PROTO");t.exports=function(t,n){var r,c=i(t),f=0,a=[];for(r in c)r!=u&&e(c,r)&&a.push(r);for(;n.length>f;)e(c,r=n[f++])&&(~o(a,r)||a.push(r));return a}},function(t,n,r){var e=r(72),i=r(30),o=r(116).f;t.exports=function(t){return function(n){for(var r,u=i(n),c=e(u),f=c.length,a=0,s=[];f>a;)o.call(u,r=c[a++])&&s.push(t?[r,u[r]]:u[r]);return s}}},function(t,n,r){var e=r(71),i=r(125),o=r(2),u=r(3).Reflect;t.exports=u&&u.ownKeys||function(t){var n=e.f(o(t)),r=i.f;return r?n.concat(r(t)):n}},function(t,n,r){var e=r(3).parseFloat,i=r(82).trim;t.exports=1/e(r(150)+"-0")!=-1/0?function(t){var n=i(String(t),3),r=e(n);return 0===r&&"-"==n.charAt(0)?-0:r}:e},function(t,n,r){var e=r(3).parseInt,i=r(82).trim,o=r(150),u=/^[\-+]?0[xX]/;t.exports=8!==e(o+"08")||22!==e(o+"0x16")?function(t,n){var r=i(String(t),3);return e(r,n>>>0||(u.test(r)?16:10))}:e},function(t,n){t.exports=Object.is||function(t,n){return t===n?0!==t||1/t==1/n:t!=t&&n!=n}},function(t,n,r){var e=r(16),i=r(149),o=r(46);t.exports=function(t,n,r,u){var c=String(o(t)),f=c.length,a=void 0===r?" ":String(r),s=e(n);if(s<=f||""==a)return c;var l=s-f,h=i.call(a,Math.ceil(l/a.length));return h.length>l&&(h=h.slice(0,l)),u?h+c:c+h}},function(t,n,r){n.f=r(7)},function(t,n,r){"use strict";var e=r(164);t.exports=r(118)("Map",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{get:function(t){var n=e.getEntry(this,t);return n&&n.v},set:function(t,n){return e.def(this,0===t?0:t,n)}},e,!0)},function(t,n,r){r(10)&&"g"!=/./g.flags&&r(11).f(RegExp.prototype,"flags",{configurable:!0,get:r(120)})},function(t,n,r){"use strict";var e=r(164);t.exports=r(118)("Set",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return e.def(this,t=0===t?0:t,t)}},e)},function(t,n,r){"use strict";var e,i=r(48)(0),o=r(28),u=r(65),c=r(172),f=r(166),a=r(6),s=u.getWeak,l=Object.isExtensible,h=f.ufstore,v={},p=function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},d={get:function(t){if(a(t)){var n=s(t);return!0===n?h(this).get(t):n?n[this._i]:void 0}},set:function(t,n){return f.def(this,t,n)}},y=t.exports=r(118)("WeakMap",p,d,f,!0,!0);7!=(new y).set((Object.freeze||Object)(v),7).get(v)&&(e=f.getConstructor(p),c(e.prototype,d),u.NEED=!0,i(["delete","has","get","set"],function(t){var n=y.prototype,r=n[t];o(n,t,function(n,i){if(a(n)&&!l(n)){this._f||(this._f=new e);var o=this._f[t](n,i);return"set"==t?this:o}return r.call(this,n,i)})}))},,,,function(t,n){"use strict";function r(){var t=document.querySelector("#page-nav");if(t&&!document.querySelector("#page-nav .extend.prev")&&(t.innerHTML='<a class="extend prev disabled" rel="prev">&laquo; Prev</a>'+t.innerHTML),t&&!document.querySelector("#page-nav .extend.next")&&(t.innerHTML=t.innerHTML+'<a class="extend next disabled" rel="next">Next &raquo;</a>'),yiliaConfig&&yiliaConfig.open_in_new){document.querySelectorAll(".article-entry a:not(.article-more-a)").forEach(function(t){var n=t.getAttribute("target");n&&""!==n||t.setAttribute("target","_blank")})}if(yiliaConfig&&yiliaConfig.toc_hide_index){document.querySelectorAll(".toc-number").forEach(function(t){t.style.display="none"})}var n=document.querySelector("#js-aboutme");n&&0!==n.length&&(n.innerHTML=n.innerText)}t.exports={init:r}},function(t,n,r){"use strict";function e(t){return t&&t.__esModule?t:{default:t}}function i(t,n){var r=/\/|index.html/g;return t.replace(r,"")===n.replace(r,"")}function o(){for(var t=document.querySelectorAll(".js-header-menu li a"),n=window.location.pathname,r=0,e=t.length;r<e;r++){var o=t[r];i(n,o.getAttribute("href"))&&(0,h.default)(o,"active")}}function u(t){for(var n=t.offsetLeft,r=t.offsetParent;null!==r;)n+=r.offsetLeft,r=r.offsetParent;return n}function c(t){for(var n=t.offsetTop,r=t.offsetParent;null!==r;)n+=r.offsetTop,r=r.offsetParent;return n}function f(t,n,r,e,i){var o=u(t),f=c(t)-n;if(f-r<=i){var a=t.$newDom;a||(a=t.cloneNode(!0),(0,d.default)(t,a),t.$newDom=a,a.style.position="fixed",a.style.top=(r||f)+"px",a.style.left=o+"px",a.style.zIndex=e||2,a.style.width="100%",a.style.color="#fff"),a.style.visibility="visible",t.style.visibility="hidden"}else{t.style.visibility="visible";var s=t.$newDom;s&&(s.style.visibility="hidden")}}function a(){var t=document.querySelector(".js-overlay"),n=document.querySelector(".js-header-menu");f(t,document.body.scrollTop,-63,2,0),f(n,document.body.scrollTop,1,3,0)}function s(){document.querySelector("#container").addEventListener("scroll",function(t){a()}),window.addEventListener("scroll",function(t){a()}),a()}var l=r(156),h=e(l),v=r(157),p=(e(v),r(382)),d=e(p),y=r(128),g=e(y),b=r(190),m=e(b),x=r(129);(function(){g.default.versions.mobile&&window.screen.width<800&&(o(),s())})(),(0,x.addLoadEvent)(function(){m.default.init()}),t.exports={}},,,,function(t,n,r){(function(t){"use strict";function n(t,n,r){t[n]||Object[e](t,n,{writable:!0,configurable:!0,value:r})}if(r(381),r(391),r(198),t._babelPolyfill)throw new Error("only one instance of babel-polyfill is allowed");t._babelPolyfill=!0;var e="defineProperty";n(String.prototype,"padLeft","".padStart),n(String.prototype,"padRight","".padEnd),"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function(t){[][t]&&n(Array,t,Function.call.bind([][t]))})}).call(n,function(){return this}())},,,function(t,n,r){r(210),t.exports=r(52).RegExp.escape},,,,function(t,n,r){var e=r(6),i=r(138),o=r(7)("species");t.exports=function(t){var n;return i(t)&&(n=t.constructor,"function"!=typeof n||n!==Array&&!i(n.prototype)||(n=void 0),e(n)&&null===(n=n[o])&&(n=void 0)),void 0===n?Array:n}},function(t,n,r){var e=r(202);t.exports=function(t,n){return new(e(t))(n)}},function(t,n,r){"use strict";var e=r(2),i=r(50),o="number";t.exports=function(t){if("string"!==t&&t!==o&&"default"!==t)throw TypeError("Incorrect hint");return i(e(this),t!=o)}},function(t,n,r){var e=r(72),i=r(125),o=r(116);t.exports=function(t){var n=e(t),r=i.f;if(r)for(var u,c=r(t),f=o.f,a=0;c.length>a;)f.call(t,u=c[a++])&&n.push(u);return n}},function(t,n,r){var e=r(72),i=r(30);t.exports=function(t,n){for(var r,o=i(t),u=e(o),c=u.length,f=0;c>f;)if(o[r=u[f++]]===n)return r}},function(t,n,r){"use strict";var e=r(208),i=r(121),o=r(26);t.exports=function(){for(var t=o(this),n=arguments.length,r=Array(n),u=0,c=e._,f=!1;n>u;)(r[u]=arguments[u++])===c&&(f=!0);return function(){var e,o=this,u=arguments.length,a=0,s=0;if(!f&&!u)return i(t,r,o);if(e=r.slice(),f)for(;n>a;a++)e[a]===c&&(e[a]=arguments[s++]);for(;u>s;)e.push(arguments[s++]);return i(t,e,o)}}},function(t,n,r){t.exports=r(3)},function(t,n){t.exports=function(t,n){var r=n===Object(n)?function(t){return n[t]}:n;return function(n){return String(n).replace(t,r)}}},function(t,n,r){var e=r(1),i=r(209)(/[\\^$*+?.()|[\]{}]/g,"\\$&");e(e.S,"RegExp",{escape:function(t){return i(t)}})},function(t,n,r){var e=r(1);e(e.P,"Array",{copyWithin:r(160)}),r(78)("copyWithin")},function(t,n,r){"use strict";var e=r(1),i=r(48)(4);e(e.P+e.F*!r(47)([].every,!0),"Array",{every:function(t){return i(this,t,arguments[1])}})},function(t,n,r){var e=r(1);e(e.P,"Array",{fill:r(130)}),r(78)("fill")},function(t,n,r){"use strict";var e=r(1),i=r(48)(2);e(e.P+e.F*!r(47)([].filter,!0),"Array",{filter:function(t){return i(this,t,arguments[1])}})},function(t,n,r){"use strict";var e=r(1),i=r(48)(6),o="findIndex",u=!0;o in[]&&Array(1)[o](function(){u=!1}),e(e.P+e.F*u,"Array",{findIndex:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),r(78)(o)},function(t,n,r){"use strict";var e=r(1),i=r(48)(5),o="find",u=!0;o in[]&&Array(1)[o](function(){u=!1}),e(e.P+e.F*u,"Array",{find:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),r(78)(o)},function(t,n,r){"use strict";var e=r(1),i=r(48)(0),o=r(47)([].forEach,!0);e(e.P+e.F*!o,"Array",{forEach:function(t){return i(this,t,arguments[1])}})},function(t,n,r){"use strict";var e=r(53),i=r(1),o=r(17),u=r(169),c=r(137),f=r(16),a=r(131),s=r(154);i(i.S+i.F*!r(123)(function(t){Array.from(t)}),"Array",{from:function(t){var n,r,i,l,h=o(t),v="function"==typeof this?this:Array,p=arguments.length,d=p>1?arguments[1]:void 0,y=void 0!==d,g=0,b=s(h);if(y&&(d=e(d,p>2?arguments[2]:void 0,2)),void 0==b||v==Array&&c(b))for(n=f(h.length),r=new v(n);n>g;g++)a(r,g,y?d(h[g],g):h[g]);else for(l=b.call(h),r=new v;!(i=l.next()).done;g++)a(r,g,y?u(l,d,[i.value,g],!0):i.value);return r.length=g,r}})},function(t,n,r){"use strict";var e=r(1),i=r(117)(!1),o=[].indexOf,u=!!o&&1/[1].indexOf(1,-0)<0;e(e.P+e.F*(u||!r(47)(o)),"Array",{indexOf:function(t){return u?o.apply(this,arguments)||0:i(this,t,arguments[1])}})},function(t,n,r){var e=r(1);e(e.S,"Array",{isArray:r(138)})},function(t,n,r){"use strict";var e=r(1),i=r(30),o=[].join;e(e.P+e.F*(r(115)!=Object||!r(47)(o)),"Array",{join:function(t){return o.call(i(this),void 0===t?",":t)}})},function(t,n,r){"use strict";var e=r(1),i=r(30),o=r(67),u=r(16),c=[].lastIndexOf,f=!!c&&1/[1].lastIndexOf(1,-0)<0;e(e.P+e.F*(f||!r(47)(c)),"Array",{lastIndexOf:function(t){if(f)return c.apply(this,arguments)||0;var n=i(this),r=u(n.length),e=r-1;for(arguments.length>1&&(e=Math.min(e,o(arguments[1]))),e<0&&(e=r+e);e>=0;e--)if(e in n&&n[e]===t)return e||0;return-1}})},function(t,n,r){"use strict";var e=r(1),i=r(48)(1);e(e.P+e.F*!r(47)([].map,!0),"Array",{map:function(t){return i(this,t,arguments[1])}})},function(t,n,r){"use strict";var e=r(1),i=r(131);e(e.S+e.F*r(4)(function(){function t(){}return!(Array.of.call(t)instanceof t)}),"Array",{of:function(){for(var t=0,n=arguments.length,r=new("function"==typeof this?this:Array)(n);n>t;)i(r,t,arguments[t++]);return r.length=n,r}})},function(t,n,r){"use strict";var e=r(1),i=r(162);e(e.P+e.F*!r(47)([].reduceRight,!0),"Array",{reduceRight:function(t){return i(this,t,arguments.length,arguments[1],!0)}})},function(t,n,r){"use strict";var e=r(1),i=r(162);e(e.P+e.F*!r(47)([].reduce,!0),"Array",{reduce:function(t){return i(this,t,arguments.length,arguments[1],!1)}})},function(t,n,r){"use strict";var e=r(1),i=r(135),o=r(45),u=r(75),c=r(16),f=[].slice;e(e.P+e.F*r(4)(function(){i&&f.call(i)}),"Array",{slice:function(t,n){var r=c(this.length),e=o(this);if(n=void 0===n?r:n,"Array"==e)return f.call(this,t,n);for(var i=u(t,r),a=u(n,r),s=c(a-i),l=Array(s),h=0;h<s;h++)l[h]="String"==e?this.charAt(i+h):this[i+h];return l}})},function(t,n,r){"use strict";var e=r(1),i=r(48)(3);e(e.P+e.F*!r(47)([].some,!0),"Array",{some:function(t){return i(this,t,arguments[1])}})},function(t,n,r){"use strict";var e=r(1),i=r(26),o=r(17),u=r(4),c=[].sort,f=[1,2,3];e(e.P+e.F*(u(function(){f.sort(void 0)})||!u(function(){f.sort(null)})||!r(47)(c)),"Array",{sort:function(t){return void 0===t?c.call(o(this)):c.call(o(this),i(t))}})},function(t,n,r){r(74)("Array")},function(t,n,r){var e=r(1);e(e.S,"Date",{now:function(){return(new Date).getTime()}})},function(t,n,r){"use strict";var e=r(1),i=r(4),o=Date.prototype.getTime,u=function(t){return t>9?t:"0"+t};e(e.P+e.F*(i(function(){return"0385-07-25T07:06:39.999Z"!=new Date(-5e13-1).toISOString()})||!i(function(){new Date(NaN).toISOString()})),"Date",{toISOString:function(){
if(!isFinite(o.call(this)))throw RangeError("Invalid time value");var t=this,n=t.getUTCFullYear(),r=t.getUTCMilliseconds(),e=n<0?"-":n>9999?"+":"";return e+("00000"+Math.abs(n)).slice(e?-6:-4)+"-"+u(t.getUTCMonth()+1)+"-"+u(t.getUTCDate())+"T"+u(t.getUTCHours())+":"+u(t.getUTCMinutes())+":"+u(t.getUTCSeconds())+"."+(r>99?r:"0"+u(r))+"Z"}})},function(t,n,r){"use strict";var e=r(1),i=r(17),o=r(50);e(e.P+e.F*r(4)(function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}),"Date",{toJSON:function(t){var n=i(this),r=o(n);return"number"!=typeof r||isFinite(r)?n.toISOString():null}})},function(t,n,r){var e=r(7)("toPrimitive"),i=Date.prototype;e in i||r(27)(i,e,r(204))},function(t,n,r){var e=Date.prototype,i="Invalid Date",o="toString",u=e[o],c=e.getTime;new Date(NaN)+""!=i&&r(28)(e,o,function(){var t=c.call(this);return t===t?u.call(this):i})},function(t,n,r){var e=r(1);e(e.P,"Function",{bind:r(163)})},function(t,n,r){"use strict";var e=r(6),i=r(32),o=r(7)("hasInstance"),u=Function.prototype;o in u||r(11).f(u,o,{value:function(t){if("function"!=typeof this||!e(t))return!1;if(!e(this.prototype))return t instanceof this;for(;t=i(t);)if(this.prototype===t)return!0;return!1}})},function(t,n,r){var e=r(11).f,i=r(66),o=r(24),u=Function.prototype,c="name",f=Object.isExtensible||function(){return!0};c in u||r(10)&&e(u,c,{configurable:!0,get:function(){try{var t=this,n=(""+t).match(/^\s*function ([^ (]*)/)[1];return o(t,c)||!f(t)||e(t,c,i(5,n)),n}catch(t){return""}}})},function(t,n,r){var e=r(1),i=r(171),o=Math.sqrt,u=Math.acosh;e(e.S+e.F*!(u&&710==Math.floor(u(Number.MAX_VALUE))&&u(1/0)==1/0),"Math",{acosh:function(t){return(t=+t)<1?NaN:t>94906265.62425156?Math.log(t)+Math.LN2:i(t-1+o(t-1)*o(t+1))}})},function(t,n,r){function e(t){return isFinite(t=+t)&&0!=t?t<0?-e(-t):Math.log(t+Math.sqrt(t*t+1)):t}var i=r(1),o=Math.asinh;i(i.S+i.F*!(o&&1/o(0)>0),"Math",{asinh:e})},function(t,n,r){var e=r(1),i=Math.atanh;e(e.S+e.F*!(i&&1/i(-0)<0),"Math",{atanh:function(t){return 0==(t=+t)?t:Math.log((1+t)/(1-t))/2}})},function(t,n,r){var e=r(1),i=r(142);e(e.S,"Math",{cbrt:function(t){return i(t=+t)*Math.pow(Math.abs(t),1/3)}})},function(t,n,r){var e=r(1);e(e.S,"Math",{clz32:function(t){return(t>>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},function(t,n,r){var e=r(1),i=Math.exp;e(e.S,"Math",{cosh:function(t){return(i(t=+t)+i(-t))/2}})},function(t,n,r){var e=r(1),i=r(141);e(e.S+e.F*(i!=Math.expm1),"Math",{expm1:i})},function(t,n,r){var e=r(1),i=r(142),o=Math.pow,u=o(2,-52),c=o(2,-23),f=o(2,127)*(2-c),a=o(2,-126),s=function(t){return t+1/u-1/u};e(e.S,"Math",{fround:function(t){var n,r,e=Math.abs(t),o=i(t);return e<a?o*s(e/a/c)*a*c:(n=(1+c/u)*e,r=n-(n-e),r>f||r!=r?o*(1/0):o*r)}})},function(t,n,r){var e=r(1),i=Math.abs;e(e.S,"Math",{hypot:function(t,n){for(var r,e,o=0,u=0,c=arguments.length,f=0;u<c;)r=i(arguments[u++]),f<r?(e=f/r,o=o*e*e+1,f=r):r>0?(e=r/f,o+=e*e):o+=r;return f===1/0?1/0:f*Math.sqrt(o)}})},function(t,n,r){var e=r(1),i=Math.imul;e(e.S+e.F*r(4)(function(){return-5!=i(4294967295,5)||2!=i.length}),"Math",{imul:function(t,n){var r=65535,e=+t,i=+n,o=r&e,u=r&i;return 0|o*u+((r&e>>>16)*u+o*(r&i>>>16)<<16>>>0)}})},function(t,n,r){var e=r(1);e(e.S,"Math",{log10:function(t){return Math.log(t)/Math.LN10}})},function(t,n,r){var e=r(1);e(e.S,"Math",{log1p:r(171)})},function(t,n,r){var e=r(1);e(e.S,"Math",{log2:function(t){return Math.log(t)/Math.LN2}})},function(t,n,r){var e=r(1);e(e.S,"Math",{sign:r(142)})},function(t,n,r){var e=r(1),i=r(141),o=Math.exp;e(e.S+e.F*r(4)(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function(t){return Math.abs(t=+t)<1?(i(t)-i(-t))/2:(o(t-1)-o(-t-1))*(Math.E/2)}})},function(t,n,r){var e=r(1),i=r(141),o=Math.exp;e(e.S,"Math",{tanh:function(t){var n=i(t=+t),r=i(-t);return n==1/0?1:r==1/0?-1:(n-r)/(o(t)+o(-t))}})},function(t,n,r){var e=r(1);e(e.S,"Math",{trunc:function(t){return(t>0?Math.floor:Math.ceil)(t)}})},function(t,n,r){"use strict";var e=r(3),i=r(24),o=r(45),u=r(136),c=r(50),f=r(4),a=r(71).f,s=r(31).f,l=r(11).f,h=r(82).trim,v="Number",p=e[v],d=p,y=p.prototype,g=o(r(70)(y))==v,b="trim"in String.prototype,m=function(t){var n=c(t,!1);if("string"==typeof n&&n.length>2){n=b?n.trim():h(n,3);var r,e,i,o=n.charCodeAt(0);if(43===o||45===o){if(88===(r=n.charCodeAt(2))||120===r)return NaN}else if(48===o){switch(n.charCodeAt(1)){case 66:case 98:e=2,i=49;break;case 79:case 111:e=8,i=55;break;default:return+n}for(var u,f=n.slice(2),a=0,s=f.length;a<s;a++)if((u=f.charCodeAt(a))<48||u>i)return NaN;return parseInt(f,e)}}return+n};if(!p(" 0o1")||!p("0b1")||p("+0x1")){p=function(t){var n=arguments.length<1?0:t,r=this;return r instanceof p&&(g?f(function(){y.valueOf.call(r)}):o(r)!=v)?u(new d(m(n)),r,p):m(n)};for(var x,w=r(10)?a(d):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),S=0;w.length>S;S++)i(d,x=w[S])&&!i(p,x)&&l(p,x,s(d,x));p.prototype=y,y.constructor=p,r(28)(e,v,p)}},function(t,n,r){var e=r(1);e(e.S,"Number",{EPSILON:Math.pow(2,-52)})},function(t,n,r){var e=r(1),i=r(3).isFinite;e(e.S,"Number",{isFinite:function(t){return"number"==typeof t&&i(t)}})},function(t,n,r){var e=r(1);e(e.S,"Number",{isInteger:r(168)})},function(t,n,r){var e=r(1);e(e.S,"Number",{isNaN:function(t){return t!=t}})},function(t,n,r){var e=r(1),i=r(168),o=Math.abs;e(e.S,"Number",{isSafeInteger:function(t){return i(t)&&o(t)<=9007199254740991}})},function(t,n,r){var e=r(1);e(e.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},function(t,n,r){var e=r(1);e(e.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},function(t,n,r){var e=r(1),i=r(178);e(e.S+e.F*(Number.parseFloat!=i),"Number",{parseFloat:i})},function(t,n,r){var e=r(1),i=r(179);e(e.S+e.F*(Number.parseInt!=i),"Number",{parseInt:i})},function(t,n,r){"use strict";var e=r(1),i=r(67),o=r(159),u=r(149),c=1..toFixed,f=Math.floor,a=[0,0,0,0,0,0],s="Number.toFixed: incorrect invocation!",l="0",h=function(t,n){for(var r=-1,e=n;++r<6;)e+=t*a[r],a[r]=e%1e7,e=f(e/1e7)},v=function(t){for(var n=6,r=0;--n>=0;)r+=a[n],a[n]=f(r/t),r=r%t*1e7},p=function(){for(var t=6,n="";--t>=0;)if(""!==n||0===t||0!==a[t]){var r=String(a[t]);n=""===n?r:n+u.call(l,7-r.length)+r}return n},d=function(t,n,r){return 0===n?r:n%2==1?d(t,n-1,r*t):d(t*t,n/2,r)},y=function(t){for(var n=0,r=t;r>=4096;)n+=12,r/=4096;for(;r>=2;)n+=1,r/=2;return n};e(e.P+e.F*(!!c&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!r(4)(function(){c.call({})})),"Number",{toFixed:function(t){var n,r,e,c,f=o(this,s),a=i(t),g="",b=l;if(a<0||a>20)throw RangeError(s);if(f!=f)return"NaN";if(f<=-1e21||f>=1e21)return String(f);if(f<0&&(g="-",f=-f),f>1e-21)if(n=y(f*d(2,69,1))-69,r=n<0?f*d(2,-n,1):f/d(2,n,1),r*=4503599627370496,(n=52-n)>0){for(h(0,r),e=a;e>=7;)h(1e7,0),e-=7;for(h(d(10,e,1),0),e=n-1;e>=23;)v(1<<23),e-=23;v(1<<e),h(1,1),v(2),b=p()}else h(0,r),h(1<<-n,0),b=p()+u.call(l,a);return a>0?(c=b.length,b=g+(c<=a?"0."+u.call(l,a-c)+b:b.slice(0,c-a)+"."+b.slice(c-a))):b=g+b,b}})},function(t,n,r){"use strict";var e=r(1),i=r(4),o=r(159),u=1..toPrecision;e(e.P+e.F*(i(function(){return"1"!==u.call(1,void 0)})||!i(function(){u.call({})})),"Number",{toPrecision:function(t){var n=o(this,"Number#toPrecision: incorrect invocation!");return void 0===t?u.call(n):u.call(n,t)}})},function(t,n,r){var e=r(1);e(e.S+e.F,"Object",{assign:r(172)})},function(t,n,r){var e=r(1);e(e.S,"Object",{create:r(70)})},function(t,n,r){var e=r(1);e(e.S+e.F*!r(10),"Object",{defineProperties:r(173)})},function(t,n,r){var e=r(1);e(e.S+e.F*!r(10),"Object",{defineProperty:r(11).f})},function(t,n,r){var e=r(6),i=r(65).onFreeze;r(49)("freeze",function(t){return function(n){return t&&e(n)?t(i(n)):n}})},function(t,n,r){var e=r(30),i=r(31).f;r(49)("getOwnPropertyDescriptor",function(){return function(t,n){return i(e(t),n)}})},function(t,n,r){r(49)("getOwnPropertyNames",function(){return r(174).f})},function(t,n,r){var e=r(17),i=r(32);r(49)("getPrototypeOf",function(){return function(t){return i(e(t))}})},function(t,n,r){var e=r(6);r(49)("isExtensible",function(t){return function(n){return!!e(n)&&(!t||t(n))}})},function(t,n,r){var e=r(6);r(49)("isFrozen",function(t){return function(n){return!e(n)||!!t&&t(n)}})},function(t,n,r){var e=r(6);r(49)("isSealed",function(t){return function(n){return!e(n)||!!t&&t(n)}})},function(t,n,r){var e=r(1);e(e.S,"Object",{is:r(180)})},function(t,n,r){var e=r(17),i=r(72);r(49)("keys",function(){return function(t){return i(e(t))}})},function(t,n,r){var e=r(6),i=r(65).onFreeze;r(49)("preventExtensions",function(t){return function(n){return t&&e(n)?t(i(n)):n}})},function(t,n,r){var e=r(6),i=r(65).onFreeze;r(49)("seal",function(t){return function(n){return t&&e(n)?t(i(n)):n}})},function(t,n,r){var e=r(1);e(e.S,"Object",{setPrototypeOf:r(144).set})},function(t,n,r){"use strict";var e=r(114),i={};i[r(7)("toStringTag")]="z",i+""!="[object z]"&&r(28)(Object.prototype,"toString",function(){return"[object "+e(this)+"]"},!0)},function(t,n,r){var e=r(1),i=r(178);e(e.G+e.F*(parseFloat!=i),{parseFloat:i})},function(t,n,r){var e=r(1),i=r(179);e(e.G+e.F*(parseInt!=i),{parseInt:i})},function(t,n,r){"use strict";var e,i,o,u=r(69),c=r(3),f=r(53),a=r(114),s=r(1),l=r(6),h=r(26),v=r(68),p=r(79),d=r(146),y=r(151).set,g=r(143)(),b="Promise",m=c.TypeError,x=c.process,w=c[b],x=c.process,S="process"==a(x),_=function(){},O=!!function(){try{var t=w.resolve(1),n=(t.constructor={})[r(7)("species")]=function(t){t(_,_)};return(S||"function"==typeof PromiseRejectionEvent)&&t.then(_)instanceof n}catch(t){}}(),E=function(t,n){return t===n||t===w&&n===o},P=function(t){var n;return!(!l(t)||"function"!=typeof(n=t.then))&&n},j=function(t){return E(w,t)?new F(t):new i(t)},F=i=function(t){var n,r;this.promise=new t(function(t,e){if(void 0!==n||void 0!==r)throw m("Bad Promise constructor");n=t,r=e}),this.resolve=h(n),this.reject=h(r)},M=function(t){try{t()}catch(t){return{error:t}}},A=function(t,n){if(!t._n){t._n=!0;var r=t._c;g(function(){for(var e=t._v,i=1==t._s,o=0;r.length>o;)!function(n){var r,o,u=i?n.ok:n.fail,c=n.resolve,f=n.reject,a=n.domain;try{u?(i||(2==t._h&&I(t),t._h=1),!0===u?r=e:(a&&a.enter(),r=u(e),a&&a.exit()),r===n.promise?f(m("Promise-chain cycle")):(o=P(r))?o.call(r,c,f):c(r)):f(e)}catch(t){f(t)}}(r[o++]);t._c=[],t._n=!1,n&&!t._h&&N(t)})}},N=function(t){y.call(c,function(){var n,r,e,i=t._v;if(T(t)&&(n=M(function(){S?x.emit("unhandledRejection",i,t):(r=c.onunhandledrejection)?r({promise:t,reason:i}):(e=c.console)&&e.error&&e.error("Unhandled promise rejection",i)}),t._h=S||T(t)?2:1),t._a=void 0,n)throw n.error})},T=function(t){if(1==t._h)return!1;for(var n,r=t._a||t._c,e=0;r.length>e;)if(n=r[e++],n.fail||!T(n.promise))return!1;return!0},I=function(t){y.call(c,function(){var n;S?x.emit("rejectionHandled",t):(n=c.onrejectionhandled)&&n({promise:t,reason:t._v})})},k=function(t){var n=this;n._d||(n._d=!0,n=n._w||n,n._v=t,n._s=2,n._a||(n._a=n._c.slice()),A(n,!0))},L=function(t){var n,r=this;if(!r._d){r._d=!0,r=r._w||r;try{if(r===t)throw m("Promise can't be resolved itself");(n=P(t))?g(function(){var e={_w:r,_d:!1};try{n.call(t,f(L,e,1),f(k,e,1))}catch(t){k.call(e,t)}}):(r._v=t,r._s=1,A(r,!1))}catch(t){k.call({_w:r,_d:!1},t)}}};O||(w=function(t){v(this,w,b,"_h"),h(t),e.call(this);try{t(f(L,this,1),f(k,this,1))}catch(t){k.call(this,t)}},e=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},e.prototype=r(73)(w.prototype,{then:function(t,n){var r=j(d(this,w));return r.ok="function"!=typeof t||t,r.fail="function"==typeof n&&n,r.domain=S?x.domain:void 0,this._c.push(r),this._a&&this._a.push(r),this._s&&A(this,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),F=function(){var t=new e;this.promise=t,this.resolve=f(L,t,1),this.reject=f(k,t,1)}),s(s.G+s.W+s.F*!O,{Promise:w}),r(81)(w,b),r(74)(b),o=r(52)[b],s(s.S+s.F*!O,b,{reject:function(t){var n=j(this);return(0,n.reject)(t),n.promise}}),s(s.S+s.F*(u||!O),b,{resolve:function(t){if(t instanceof w&&E(t.constructor,this))return t;var n=j(this);return(0,n.resolve)(t),n.promise}}),s(s.S+s.F*!(O&&r(123)(function(t){w.all(t).catch(_)})),b,{all:function(t){var n=this,r=j(n),e=r.resolve,i=r.reject,o=M(function(){var r=[],o=0,u=1;p(t,!1,function(t){var c=o++,f=!1;r.push(void 0),u++,n.resolve(t).then(function(t){f||(f=!0,r[c]=t,--u||e(r))},i)}),--u||e(r)});return o&&i(o.error),r.promise},race:function(t){var n=this,r=j(n),e=r.reject,i=M(function(){p(t,!1,function(t){n.resolve(t).then(r.resolve,e)})});return i&&e(i.error),r.promise}})},function(t,n,r){var e=r(1),i=r(26),o=r(2),u=(r(3).Reflect||{}).apply,c=Function.apply;e(e.S+e.F*!r(4)(function(){u(function(){})}),"Reflect",{apply:function(t,n,r){var e=i(t),f=o(r);return u?u(e,n,f):c.call(e,n,f)}})},function(t,n,r){var e=r(1),i=r(70),o=r(26),u=r(2),c=r(6),f=r(4),a=r(163),s=(r(3).Reflect||{}).construct,l=f(function(){function t(){}return!(s(function(){},[],t)instanceof t)}),h=!f(function(){s(function(){})});e(e.S+e.F*(l||h),"Reflect",{construct:function(t,n){o(t),u(n);var r=arguments.length<3?t:o(arguments[2]);if(h&&!l)return s(t,n,r);if(t==r){switch(n.length){case 0:return new t;case 1:return new t(n[0]);case 2:return new t(n[0],n[1]);case 3:return new t(n[0],n[1],n[2]);case 4:return new t(n[0],n[1],n[2],n[3])}var e=[null];return e.push.apply(e,n),new(a.apply(t,e))}var f=r.prototype,v=i(c(f)?f:Object.prototype),p=Function.apply.call(t,v,n);return c(p)?p:v}})},function(t,n,r){var e=r(11),i=r(1),o=r(2),u=r(50);i(i.S+i.F*r(4)(function(){Reflect.defineProperty(e.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(t,n,r){o(t),n=u(n,!0),o(r);try{return e.f(t,n,r),!0}catch(t){return!1}}})},function(t,n,r){var e=r(1),i=r(31).f,o=r(2);e(e.S,"Reflect",{deleteProperty:function(t,n){var r=i(o(t),n);return!(r&&!r.configurable)&&delete t[n]}})},function(t,n,r){"use strict";var e=r(1),i=r(2),o=function(t){this._t=i(t),this._i=0;var n,r=this._k=[];for(n in t)r.push(n)};r(139)(o,"Object",function(){var t,n=this,r=n._k;do{if(n._i>=r.length)return{value:void 0,done:!0}}while(!((t=r[n._i++])in n._t));return{value:t,done:!1}}),e(e.S,"Reflect",{enumerate:function(t){return new o(t)}})},function(t,n,r){var e=r(31),i=r(1),o=r(2);i(i.S,"Reflect",{getOwnPropertyDescriptor:function(t,n){return e.f(o(t),n)}})},function(t,n,r){var e=r(1),i=r(32),o=r(2);e(e.S,"Reflect",{getPrototypeOf:function(t){return i(o(t))}})},function(t,n,r){function e(t,n){var r,c,s=arguments.length<3?t:arguments[2];return a(t)===s?t[n]:(r=i.f(t,n))?u(r,"value")?r.value:void 0!==r.get?r.get.call(s):void 0:f(c=o(t))?e(c,n,s):void 0}var i=r(31),o=r(32),u=r(24),c=r(1),f=r(6),a=r(2);c(c.S,"Reflect",{get:e})},function(t,n,r){var e=r(1);e(e.S,"Reflect",{has:function(t,n){return n in t}})},function(t,n,r){var e=r(1),i=r(2),o=Object.isExtensible;e(e.S,"Reflect",{isExtensible:function(t){return i(t),!o||o(t)}})},function(t,n,r){var e=r(1);e(e.S,"Reflect",{ownKeys:r(177)})},function(t,n,r){var e=r(1),i=r(2),o=Object.preventExtensions;e(e.S,"Reflect",{preventExtensions:function(t){i(t);try{return o&&o(t),!0}catch(t){return!1}}})},function(t,n,r){var e=r(1),i=r(144);i&&e(e.S,"Reflect",{setPrototypeOf:function(t,n){i.check(t,n);try{return i.set(t,n),!0}catch(t){return!1}}})},function(t,n,r){function e(t,n,r){var f,h,v=arguments.length<4?t:arguments[3],p=o.f(s(t),n);if(!p){if(l(h=u(t)))return e(h,n,r,v);p=a(0)}return c(p,"value")?!(!1===p.writable||!l(v)||(f=o.f(v,n)||a(0),f.value=r,i.f(v,n,f),0)):void 0!==p.set&&(p.set.call(v,r),!0)}var i=r(11),o=r(31),u=r(32),c=r(24),f=r(1),a=r(66),s=r(2),l=r(6);f(f.S,"Reflect",{set:e})},function(t,n,r){var e=r(3),i=r(136),o=r(11).f,u=r(71).f,c=r(122),f=r(120),a=e.RegExp,s=a,l=a.prototype,h=/a/g,v=/a/g,p=new a(h)!==h;if(r(10)&&(!p||r(4)(function(){return v[r(7)("match")]=!1,a(h)!=h||a(v)==v||"/a/i"!=a(h,"i")}))){a=function(t,n){var r=this instanceof a,e=c(t),o=void 0===n;return!r&&e&&t.constructor===a&&o?t:i(p?new s(e&&!o?t.source:t,n):s((e=t instanceof a)?t.source:t,e&&o?f.call(t):n),r?this:l,a)};for(var d=u(s),y=0;d.length>y;)!function(t){t in a||o(a,t,{configurable:!0,get:function(){return s[t]},set:function(n){s[t]=n}})}(d[y++]);l.constructor=a,a.prototype=l,r(28)(e,"RegExp",a)}r(74)("RegExp")},function(t,n,r){r(119)("match",1,function(t,n,r){return[function(r){"use strict";var e=t(this),i=void 0==r?void 0:r[n];return void 0!==i?i.call(r,e):new RegExp(r)[n](String(e))},r]})},function(t,n,r){r(119)("replace",2,function(t,n,r){return[function(e,i){"use strict";var o=t(this),u=void 0==e?void 0:e[n];return void 0!==u?u.call(e,o,i):r.call(String(o),e,i)},r]})},function(t,n,r){r(119)("search",1,function(t,n,r){return[function(r){"use strict";var e=t(this),i=void 0==r?void 0:r[n];return void 0!==i?i.call(r,e):new RegExp(r)[n](String(e))},r]})},function(t,n,r){r(119)("split",2,function(t,n,e){"use strict";var i=r(122),o=e,u=[].push,c="split",f="length",a="lastIndex";if("c"=="abbc"[c](/(b)*/)[1]||4!="test"[c](/(?:)/,-1)[f]||2!="ab"[c](/(?:ab)*/)[f]||4!="."[c](/(.?)(.?)/)[f]||"."[c](/()()/)[f]>1||""[c](/.?/)[f]){var s=void 0===/()??/.exec("")[1];e=function(t,n){var r=String(this);if(void 0===t&&0===n)return[];if(!i(t))return o.call(r,t,n);var e,c,l,h,v,p=[],d=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),y=0,g=void 0===n?4294967295:n>>>0,b=new RegExp(t.source,d+"g");for(s||(e=new RegExp("^"+b.source+"$(?!\\s)",d));(c=b.exec(r))&&!((l=c.index+c[0][f])>y&&(p.push(r.slice(y,c.index)),!s&&c[f]>1&&c[0].replace(e,function(){for(v=1;v<arguments[f]-2;v++)void 0===arguments[v]&&(c[v]=void 0)}),c[f]>1&&c.index<r[f]&&u.apply(p,c.slice(1)),h=c[0][f],y=l,p[f]>=g));)b[a]===c.index&&b[a]++;return y===r[f]?!h&&b.test("")||p.push(""):p.push(r.slice(y)),p[f]>g?p.slice(0,g):p}}else"0"[c](void 0,0)[f]&&(e=function(t,n){return void 0===t&&0===n?[]:o.call(this,t,n)});return[function(r,i){var o=t(this),u=void 0==r?void 0:r[n];return void 0!==u?u.call(r,o,i):e.call(String(o),r,i)},e]})},function(t,n,r){"use strict";r(184);var e=r(2),i=r(120),o=r(10),u="toString",c=/./[u],f=function(t){r(28)(RegExp.prototype,u,t,!0)};r(4)(function(){return"/a/b"!=c.call({source:"a",flags:"b"})})?f(function(){var t=e(this);return"/".concat(t.source,"/","flags"in t?t.flags:!o&&t instanceof RegExp?i.call(t):void 0)}):c.name!=u&&f(function(){return c.call(this)})},function(t,n,r){"use strict";r(29)("anchor",function(t){return function(n){return t(this,"a","name",n)}})},function(t,n,r){"use strict";r(29)("big",function(t){return function(){return t(this,"big","","")}})},function(t,n,r){"use strict";r(29)("blink",function(t){return function(){return t(this,"blink","","")}})},function(t,n,r){"use strict";r(29)("bold",function(t){return function(){return t(this,"b","","")}})},function(t,n,r){"use strict";var e=r(1),i=r(147)(!1);e(e.P,"String",{codePointAt:function(t){return i(this,t)}})},function(t,n,r){"use strict";var e=r(1),i=r(16),o=r(148),u="endsWith",c=""[u];e(e.P+e.F*r(134)(u),"String",{endsWith:function(t){var n=o(this,t,u),r=arguments.length>1?arguments[1]:void 0,e=i(n.length),f=void 0===r?e:Math.min(i(r),e),a=String(t);return c?c.call(n,a,f):n.slice(f-a.length,f)===a}})},function(t,n,r){"use strict";r(29)("fixed",function(t){return function(){return t(this,"tt","","")}})},function(t,n,r){"use strict";r(29)("fontcolor",function(t){return function(n){return t(this,"font","color",n)}})},function(t,n,r){"use strict";r(29)("fontsize",function(t){return function(n){return t(this,"font","size",n)}})},function(t,n,r){var e=r(1),i=r(75),o=String.fromCharCode,u=String.fromCodePoint;e(e.S+e.F*(!!u&&1!=u.length),"String",{fromCodePoint:function(t){for(var n,r=[],e=arguments.length,u=0;e>u;){if(n=+arguments[u++],i(n,1114111)!==n)throw RangeError(n+" is not a valid code point");r.push(n<65536?o(n):o(55296+((n-=65536)>>10),n%1024+56320))}return r.join("")}})},function(t,n,r){"use strict";var e=r(1),i=r(148),o="includes";e(e.P+e.F*r(134)(o),"String",{includes:function(t){return!!~i(this,t,o).indexOf(t,arguments.length>1?arguments[1]:void 0)}})},function(t,n,r){"use strict";r(29)("italics",function(t){return function(){return t(this,"i","","")}})},function(t,n,r){"use strict";var e=r(147)(!0);r(140)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,n=this._t,r=this._i;return r>=n.length?{value:void 0,done:!0}:(t=e(n,r),this._i+=t.length,{value:t,done:!1})})},function(t,n,r){"use strict";r(29)("link",function(t){return function(n){return t(this,"a","href",n)}})},function(t,n,r){var e=r(1),i=r(30),o=r(16);e(e.S,"String",{raw:function(t){for(var n=i(t.raw),r=o(n.length),e=arguments.length,u=[],c=0;r>c;)u.push(String(n[c++])),c<e&&u.push(String(arguments[c]));return u.join("")}})},function(t,n,r){var e=r(1);e(e.P,"String",{repeat:r(149)})},function(t,n,r){"use strict";r(29)("small",function(t){return function(){return t(this,"small","","")}})},function(t,n,r){"use strict";var e=r(1),i=r(16),o=r(148),u="startsWith",c=""[u];e(e.P+e.F*r(134)(u),"String",{startsWith:function(t){var n=o(this,t,u),r=i(Math.min(arguments.length>1?arguments[1]:void 0,n.length)),e=String(t);return c?c.call(n,e,r):n.slice(r,r+e.length)===e}})},function(t,n,r){"use strict";r(29)("strike",function(t){return function(){return t(this,"strike","","")}})},function(t,n,r){"use strict";r(29)("sub",function(t){return function(){return t(this,"sub","","")}})},function(t,n,r){"use strict";r(29)("sup",function(t){return function(){return t(this,"sup","","")}})},function(t,n,r){"use strict";r(82)("trim",function(t){return function(){return t(this,3)}})},function(t,n,r){"use strict";var e=r(3),i=r(24),o=r(10),u=r(1),c=r(28),f=r(65).KEY,a=r(4),s=r(126),l=r(81),h=r(76),v=r(7),p=r(182),d=r(153),y=r(206),g=r(205),b=r(138),m=r(2),x=r(30),w=r(50),S=r(66),_=r(70),O=r(174),E=r(31),P=r(11),j=r(72),F=E.f,M=P.f,A=O.f,N=e.Symbol,T=e.JSON,I=T&&T.stringify,k="prototype",L=v("_hidden"),R=v("toPrimitive"),C={}.propertyIsEnumerable,D=s("symbol-registry"),U=s("symbols"),W=s("op-symbols"),G=Object[k],B="function"==typeof N,V=e.QObject,z=!V||!V[k]||!V[k].findChild,q=o&&a(function(){return 7!=_(M({},"a",{get:function(){return M(this,"a",{value:7}).a}})).a})?function(t,n,r){var e=F(G,n);e&&delete G[n],M(t,n,r),e&&t!==G&&M(G,n,e)}:M,K=function(t){var n=U[t]=_(N[k]);return n._k=t,n},J=B&&"symbol"==typeof N.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof N},Y=function(t,n,r){return t===G&&Y(W,n,r),m(t),n=w(n,!0),m(r),i(U,n)?(r.enumerable?(i(t,L)&&t[L][n]&&(t[L][n]=!1),r=_(r,{enumerable:S(0,!1)})):(i(t,L)||M(t,L,S(1,{})),t[L][n]=!0),q(t,n,r)):M(t,n,r)},H=function(t,n){m(t);for(var r,e=g(n=x(n)),i=0,o=e.length;o>i;)Y(t,r=e[i++],n[r]);return t},$=function(t,n){return void 0===n?_(t):H(_(t),n)},X=function(t){var n=C.call(this,t=w(t,!0));return!(this===G&&i(U,t)&&!i(W,t))&&(!(n||!i(this,t)||!i(U,t)||i(this,L)&&this[L][t])||n)},Q=function(t,n){if(t=x(t),n=w(n,!0),t!==G||!i(U,n)||i(W,n)){var r=F(t,n);return!r||!i(U,n)||i(t,L)&&t[L][n]||(r.enumerable=!0),r}},Z=function(t){for(var n,r=A(x(t)),e=[],o=0;r.length>o;)i(U,n=r[o++])||n==L||n==f||e.push(n);return e},tt=function(t){for(var n,r=t===G,e=A(r?W:x(t)),o=[],u=0;e.length>u;)!i(U,n=e[u++])||r&&!i(G,n)||o.push(U[n]);return o};B||(N=function(){if(this instanceof N)throw TypeError("Symbol is not a constructor!");var t=h(arguments.length>0?arguments[0]:void 0),n=function(r){this===G&&n.call(W,r),i(this,L)&&i(this[L],t)&&(this[L][t]=!1),q(this,t,S(1,r))};return o&&z&&q(G,t,{configurable:!0,set:n}),K(t)},c(N[k],"toString",function(){return this._k}),E.f=Q,P.f=Y,r(71).f=O.f=Z,r(116).f=X,r(125).f=tt,o&&!r(69)&&c(G,"propertyIsEnumerable",X,!0),p.f=function(t){return K(v(t))}),u(u.G+u.W+u.F*!B,{Symbol:N});for(var nt="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),rt=0;nt.length>rt;)v(nt[rt++]);for(var nt=j(v.store),rt=0;nt.length>rt;)d(nt[rt++]);u(u.S+u.F*!B,"Symbol",{for:function(t){return i(D,t+="")?D[t]:D[t]=N(t)},keyFor:function(t){if(J(t))return y(D,t);throw TypeError(t+" is not a symbol!")},useSetter:function(){z=!0},useSimple:function(){z=!1}}),u(u.S+u.F*!B,"Object",{create:$,defineProperty:Y,defineProperties:H,getOwnPropertyDescriptor:Q,getOwnPropertyNames:Z,getOwnPropertySymbols:tt}),T&&u(u.S+u.F*(!B||a(function(){var t=N();return"[null]"!=I([t])||"{}"!=I({a:t})||"{}"!=I(Object(t))})),"JSON",{stringify:function(t){if(void 0!==t&&!J(t)){for(var n,r,e=[t],i=1;arguments.length>i;)e.push(arguments[i++]);return n=e[1],"function"==typeof n&&(r=n),!r&&b(n)||(n=function(t,n){if(r&&(n=r.call(this,t,n)),!J(n))return n}),e[1]=n,I.apply(T,e)}}}),N[k][R]||r(27)(N[k],R,N[k].valueOf),l(N,"Symbol"),l(Math,"Math",!0),l(e.JSON,"JSON",!0)},function(t,n,r){"use strict";var e=r(1),i=r(127),o=r(152),u=r(2),c=r(75),f=r(16),a=r(6),s=r(3).ArrayBuffer,l=r(146),h=o.ArrayBuffer,v=o.DataView,p=i.ABV&&s.isView,d=h.prototype.slice,y=i.VIEW,g="ArrayBuffer";e(e.G+e.W+e.F*(s!==h),{ArrayBuffer:h}),e(e.S+e.F*!i.CONSTR,g,{isView:function(t){return p&&p(t)||a(t)&&y in t}}),e(e.P+e.U+e.F*r(4)(function(){return!new h(2).slice(1,void 0).byteLength}),g,{slice:function(t,n){if(void 0!==d&&void 0===n)return d.call(u(this),t);for(var r=u(this).byteLength,e=c(t,r),i=c(void 0===n?r:n,r),o=new(l(this,h))(f(i-e)),a=new v(this),s=new v(o),p=0;e<i;)s.setUint8(p++,a.getUint8(e++));return o}}),r(74)(g)},function(t,n,r){var e=r(1);e(e.G+e.W+e.F*!r(127).ABV,{DataView:r(152).DataView})},function(t,n,r){r(55)("Float32",4,function(t){return function(n,r,e){return t(this,n,r,e)}})},function(t,n,r){r(55)("Float64",8,function(t){return function(n,r,e){return t(this,n,r,e)}})},function(t,n,r){r(55)("Int16",2,function(t){return function(n,r,e){return t(this,n,r,e)}})},function(t,n,r){r(55)("Int32",4,function(t){return function(n,r,e){return t(this,n,r,e)}})},function(t,n,r){r(55)("Int8",1,function(t){return function(n,r,e){return t(this,n,r,e)}})},function(t,n,r){r(55)("Uint16",2,function(t){return function(n,r,e){return t(this,n,r,e)}})},function(t,n,r){r(55)("Uint32",4,function(t){return function(n,r,e){return t(this,n,r,e)}})},function(t,n,r){r(55)("Uint8",1,function(t){return function(n,r,e){return t(this,n,r,e)}})},function(t,n,r){r(55)("Uint8",1,function(t){return function(n,r,e){return t(this,n,r,e)}},!0)},function(t,n,r){"use strict";var e=r(166);r(118)("WeakSet",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return e.def(this,t,!0)}},e,!1,!0)},function(t,n,r){"use strict";var e=r(1),i=r(117)(!0);e(e.P,"Array",{includes:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),r(78)("includes")},function(t,n,r){var e=r(1),i=r(143)(),o=r(3).process,u="process"==r(45)(o);e(e.G,{asap:function(t){var n=u&&o.domain;i(n?n.bind(t):t)}})},function(t,n,r){var e=r(1),i=r(45);e(e.S,"Error",{isError:function(t){return"Error"===i(t)}})},function(t,n,r){var e=r(1);e(e.P+e.R,"Map",{toJSON:r(165)("Map")})},function(t,n,r){var e=r(1);e(e.S,"Math",{iaddh:function(t,n,r,e){var i=t>>>0,o=n>>>0,u=r>>>0;return o+(e>>>0)+((i&u|(i|u)&~(i+u>>>0))>>>31)|0}})},function(t,n,r){var e=r(1);e(e.S,"Math",{imulh:function(t,n){var r=65535,e=+t,i=+n,o=e&r,u=i&r,c=e>>16,f=i>>16,a=(c*u>>>0)+(o*u>>>16);return c*f+(a>>16)+((o*f>>>0)+(a&r)>>16)}})},function(t,n,r){var e=r(1);e(e.S,"Math",{isubh:function(t,n,r,e){var i=t>>>0,o=n>>>0,u=r>>>0;return o-(e>>>0)-((~i&u|~(i^u)&i-u>>>0)>>>31)|0}})},function(t,n,r){var e=r(1);e(e.S,"Math",{umulh:function(t,n){var r=65535,e=+t,i=+n,o=e&r,u=i&r,c=e>>>16,f=i>>>16,a=(c*u>>>0)+(o*u>>>16);return c*f+(a>>>16)+((o*f>>>0)+(a&r)>>>16)}})},function(t,n,r){"use strict";var e=r(1),i=r(17),o=r(26),u=r(11);r(10)&&e(e.P+r(124),"Object",{__defineGetter__:function(t,n){u.f(i(this),t,{get:o(n),enumerable:!0,configurable:!0})}})},function(t,n,r){"use strict";var e=r(1),i=r(17),o=r(26),u=r(11);r(10)&&e(e.P+r(124),"Object",{__defineSetter__:function(t,n){u.f(i(this),t,{set:o(n),enumerable:!0,configurable:!0})}})},function(t,n,r){var e=r(1),i=r(176)(!0);e(e.S,"Object",{entries:function(t){return i(t)}})},function(t,n,r){var e=r(1),i=r(177),o=r(30),u=r(31),c=r(131);e(e.S,"Object",{getOwnPropertyDescriptors:function(t){for(var n,r=o(t),e=u.f,f=i(r),a={},s=0;f.length>s;)c(a,n=f[s++],e(r,n));return a}})},function(t,n,r){"use strict";var e=r(1),i=r(17),o=r(50),u=r(32),c=r(31).f;r(10)&&e(e.P+r(124),"Object",{__lookupGetter__:function(t){var n,r=i(this),e=o(t,!0);do{if(n=c(r,e))return n.get}while(r=u(r))}})},function(t,n,r){"use strict";var e=r(1),i=r(17),o=r(50),u=r(32),c=r(31).f;r(10)&&e(e.P+r(124),"Object",{__lookupSetter__:function(t){var n,r=i(this),e=o(t,!0);do{if(n=c(r,e))return n.set}while(r=u(r))}})},function(t,n,r){var e=r(1),i=r(176)(!1);e(e.S,"Object",{values:function(t){return i(t)}})},function(t,n,r){"use strict";var e=r(1),i=r(3),o=r(52),u=r(143)(),c=r(7)("observable"),f=r(26),a=r(2),s=r(68),l=r(73),h=r(27),v=r(79),p=v.RETURN,d=function(t){return null==t?void 0:f(t)},y=function(t){var n=t._c;n&&(t._c=void 0,n())},g=function(t){return void 0===t._o},b=function(t){g(t)||(t._o=void 0,y(t))},m=function(t,n){a(t),this._c=void 0,this._o=t,t=new x(this);try{var r=n(t),e=r;null!=r&&("function"==typeof r.unsubscribe?r=function(){e.unsubscribe()}:f(r),this._c=r)}catch(n){return void t.error(n)}g(this)&&y(this)};m.prototype=l({},{unsubscribe:function(){b(this)}});var x=function(t){this._s=t};x.prototype=l({},{next:function(t){var n=this._s;if(!g(n)){var r=n._o;try{var e=d(r.next);if(e)return e.call(r,t)}catch(t){try{b(n)}finally{throw t}}}},error:function(t){var n=this._s;if(g(n))throw t;var r=n._o;n._o=void 0;try{var e=d(r.error);if(!e)throw t;t=e.call(r,t)}catch(t){try{y(n)}finally{throw t}}return y(n),t},complete:function(t){var n=this._s;if(!g(n)){var r=n._o;n._o=void 0;try{var e=d(r.complete);t=e?e.call(r,t):void 0}catch(t){try{y(n)}finally{throw t}}return y(n),t}}});var w=function(t){s(this,w,"Observable","_f")._f=f(t)};l(w.prototype,{subscribe:function(t){return new m(t,this._f)},forEach:function(t){var n=this;return new(o.Promise||i.Promise)(function(r,e){f(t);var i=n.subscribe({next:function(n){try{return t(n)}catch(t){e(t),i.unsubscribe()}},error:e,complete:r})})}}),l(w,{from:function(t){var n="function"==typeof this?this:w,r=d(a(t)[c]);if(r){var e=a(r.call(t));return e.constructor===n?e:new n(function(t){return e.subscribe(t)})}return new n(function(n){var r=!1;return u(function(){if(!r){try{if(v(t,!1,function(t){if(n.next(t),r)return p})===p)return}catch(t){if(r)throw t;return void n.error(t)}n.complete()}}),function(){r=!0}})},of:function(){for(var t=0,n=arguments.length,r=Array(n);t<n;)r[t]=arguments[t++];return new("function"==typeof this?this:w)(function(t){var n=!1;return u(function(){if(!n){for(var e=0;e<r.length;++e)if(t.next(r[e]),n)return;t.complete()}}),function(){n=!0}})}}),h(w.prototype,c,function(){return this}),e(e.G,{Observable:w}),r(74)("Observable")},function(t,n,r){var e=r(54),i=r(2),o=e.key,u=e.set;e.exp({defineMetadata:function(t,n,r,e){u(t,n,i(r),o(e))}})},function(t,n,r){var e=r(54),i=r(2),o=e.key,u=e.map,c=e.store;e.exp({deleteMetadata:function(t,n){var r=arguments.length<3?void 0:o(arguments[2]),e=u(i(n),r,!1);if(void 0===e||!e.delete(t))return!1;if(e.size)return!0;var f=c.get(n);return f.delete(r),!!f.size||c.delete(n)}})},function(t,n,r){var e=r(185),i=r(161),o=r(54),u=r(2),c=r(32),f=o.keys,a=o.key,s=function(t,n){var r=f(t,n),o=c(t);if(null===o)return r;var u=s(o,n);return u.length?r.length?i(new e(r.concat(u))):u:r};o.exp({getMetadataKeys:function(t){return s(u(t),arguments.length<2?void 0:a(arguments[1]))}})},function(t,n,r){var e=r(54),i=r(2),o=r(32),u=e.has,c=e.get,f=e.key,a=function(t,n,r){if(u(t,n,r))return c(t,n,r);var e=o(n);return null!==e?a(t,e,r):void 0};e.exp({getMetadata:function(t,n){return a(t,i(n),arguments.length<3?void 0:f(arguments[2]))}})},function(t,n,r){var e=r(54),i=r(2),o=e.keys,u=e.key;e.exp({getOwnMetadataKeys:function(t){
return o(i(t),arguments.length<2?void 0:u(arguments[1]))}})},function(t,n,r){var e=r(54),i=r(2),o=e.get,u=e.key;e.exp({getOwnMetadata:function(t,n){return o(t,i(n),arguments.length<3?void 0:u(arguments[2]))}})},function(t,n,r){var e=r(54),i=r(2),o=r(32),u=e.has,c=e.key,f=function(t,n,r){if(u(t,n,r))return!0;var e=o(n);return null!==e&&f(t,e,r)};e.exp({hasMetadata:function(t,n){return f(t,i(n),arguments.length<3?void 0:c(arguments[2]))}})},function(t,n,r){var e=r(54),i=r(2),o=e.has,u=e.key;e.exp({hasOwnMetadata:function(t,n){return o(t,i(n),arguments.length<3?void 0:u(arguments[2]))}})},function(t,n,r){var e=r(54),i=r(2),o=r(26),u=e.key,c=e.set;e.exp({metadata:function(t,n){return function(r,e){c(t,n,(void 0!==e?i:o)(r),u(e))}}})},function(t,n,r){var e=r(1);e(e.P+e.R,"Set",{toJSON:r(165)("Set")})},function(t,n,r){"use strict";var e=r(1),i=r(147)(!0);e(e.P,"String",{at:function(t){return i(this,t)}})},function(t,n,r){"use strict";var e=r(1),i=r(46),o=r(16),u=r(122),c=r(120),f=RegExp.prototype,a=function(t,n){this._r=t,this._s=n};r(139)(a,"RegExp String",function(){var t=this._r.exec(this._s);return{value:t,done:null===t}}),e(e.P,"String",{matchAll:function(t){if(i(this),!u(t))throw TypeError(t+" is not a regexp!");var n=String(this),r="flags"in f?String(t.flags):c.call(t),e=new RegExp(t.source,~r.indexOf("g")?r:"g"+r);return e.lastIndex=o(t.lastIndex),new a(e,n)}})},function(t,n,r){"use strict";var e=r(1),i=r(181);e(e.P,"String",{padEnd:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0,!1)}})},function(t,n,r){"use strict";var e=r(1),i=r(181);e(e.P,"String",{padStart:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0,!0)}})},function(t,n,r){"use strict";r(82)("trimLeft",function(t){return function(){return t(this,1)}},"trimStart")},function(t,n,r){"use strict";r(82)("trimRight",function(t){return function(){return t(this,2)}},"trimEnd")},function(t,n,r){r(153)("asyncIterator")},function(t,n,r){r(153)("observable")},function(t,n,r){var e=r(1);e(e.S,"System",{global:r(3)})},function(t,n,r){for(var e=r(155),i=r(28),o=r(3),u=r(27),c=r(80),f=r(7),a=f("iterator"),s=f("toStringTag"),l=c.Array,h=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],v=0;v<5;v++){var p,d=h[v],y=o[d],g=y&&y.prototype;if(g){g[a]||u(g,a,l),g[s]||u(g,s,d),c[d]=l;for(p in e)g[p]||i(g,p,e[p],!0)}}},function(t,n,r){var e=r(1),i=r(151);e(e.G+e.B,{setImmediate:i.set,clearImmediate:i.clear})},function(t,n,r){var e=r(3),i=r(1),o=r(121),u=r(207),c=e.navigator,f=!!c&&/MSIE .\./.test(c.userAgent),a=function(t){return f?function(n,r){return t(o(u,[].slice.call(arguments,2),"function"==typeof n?n:Function(n)),r)}:t};i(i.G+i.B+i.F*f,{setTimeout:a(e.setTimeout),setInterval:a(e.setInterval)})},function(t,n,r){r(330),r(269),r(271),r(270),r(273),r(275),r(280),r(274),r(272),r(282),r(281),r(277),r(278),r(276),r(268),r(279),r(283),r(284),r(236),r(238),r(237),r(286),r(285),r(256),r(266),r(267),r(257),r(258),r(259),r(260),r(261),r(262),r(263),r(264),r(265),r(239),r(240),r(241),r(242),r(243),r(244),r(245),r(246),r(247),r(248),r(249),r(250),r(251),r(252),r(253),r(254),r(255),r(317),r(322),r(329),r(320),r(312),r(313),r(318),r(323),r(325),r(308),r(309),r(310),r(311),r(314),r(315),r(316),r(319),r(321),r(324),r(326),r(327),r(328),r(231),r(233),r(232),r(235),r(234),r(220),r(218),r(224),r(221),r(227),r(229),r(217),r(223),r(214),r(228),r(212),r(226),r(225),r(219),r(222),r(211),r(213),r(216),r(215),r(230),r(155),r(302),r(307),r(184),r(303),r(304),r(305),r(306),r(287),r(183),r(185),r(186),r(342),r(331),r(332),r(337),r(340),r(341),r(335),r(338),r(336),r(339),r(333),r(334),r(288),r(289),r(290),r(291),r(292),r(295),r(293),r(294),r(296),r(297),r(298),r(299),r(301),r(300),r(343),r(369),r(372),r(371),r(373),r(374),r(370),r(375),r(376),r(354),r(357),r(353),r(351),r(352),r(355),r(356),r(346),r(368),r(377),r(345),r(347),r(349),r(348),r(350),r(359),r(360),r(362),r(361),r(364),r(363),r(365),r(366),r(367),r(344),r(358),r(380),r(379),r(378),t.exports=r(52)},function(t,n){function r(t,n){if("string"==typeof n)return t.insertAdjacentHTML("afterend",n);var r=t.nextSibling;return r?t.parentNode.insertBefore(n,r):t.parentNode.appendChild(n)}t.exports=r},,,,,,,,,function(t,n,r){(function(n,r){!function(n){"use strict";function e(t,n,r,e){var i=n&&n.prototype instanceof o?n:o,u=Object.create(i.prototype),c=new p(e||[]);return u._invoke=s(t,r,c),u}function i(t,n,r){try{return{type:"normal",arg:t.call(n,r)}}catch(t){return{type:"throw",arg:t}}}function o(){}function u(){}function c(){}function f(t){["next","throw","return"].forEach(function(n){t[n]=function(t){return this._invoke(n,t)}})}function a(t){function n(r,e,o,u){var c=i(t[r],t,e);if("throw"!==c.type){var f=c.arg,a=f.value;return a&&"object"==typeof a&&m.call(a,"__await")?Promise.resolve(a.__await).then(function(t){n("next",t,o,u)},function(t){n("throw",t,o,u)}):Promise.resolve(a).then(function(t){f.value=t,o(f)},u)}u(c.arg)}function e(t,r){function e(){return new Promise(function(e,i){n(t,r,e,i)})}return o=o?o.then(e,e):e()}"object"==typeof r&&r.domain&&(n=r.domain.bind(n));var o;this._invoke=e}function s(t,n,r){var e=P;return function(o,u){if(e===F)throw new Error("Generator is already running");if(e===M){if("throw"===o)throw u;return y()}for(r.method=o,r.arg=u;;){var c=r.delegate;if(c){var f=l(c,r);if(f){if(f===A)continue;return f}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(e===P)throw e=M,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);e=F;var a=i(t,n,r);if("normal"===a.type){if(e=r.done?M:j,a.arg===A)continue;return{value:a.arg,done:r.done}}"throw"===a.type&&(e=M,r.method="throw",r.arg=a.arg)}}}function l(t,n){var r=t.iterator[n.method];if(r===g){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=g,l(t,n),"throw"===n.method))return A;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return A}var e=i(r,t.iterator,n.arg);if("throw"===e.type)return n.method="throw",n.arg=e.arg,n.delegate=null,A;var o=e.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=g),n.delegate=null,A):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,A)}function h(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function v(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function p(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(h,this),this.reset(!0)}function d(t){if(t){var n=t[w];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,e=function n(){for(;++r<t.length;)if(m.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=g,n.done=!0,n};return e.next=e}}return{next:y}}function y(){return{value:g,done:!0}}var g,b=Object.prototype,m=b.hasOwnProperty,x="function"==typeof Symbol?Symbol:{},w=x.iterator||"@@iterator",S=x.asyncIterator||"@@asyncIterator",_=x.toStringTag||"@@toStringTag",O="object"==typeof t,E=n.regeneratorRuntime;if(E)return void(O&&(t.exports=E));E=n.regeneratorRuntime=O?t.exports:{},E.wrap=e;var P="suspendedStart",j="suspendedYield",F="executing",M="completed",A={},N={};N[w]=function(){return this};var T=Object.getPrototypeOf,I=T&&T(T(d([])));I&&I!==b&&m.call(I,w)&&(N=I);var k=c.prototype=o.prototype=Object.create(N);u.prototype=k.constructor=c,c.constructor=u,c[_]=u.displayName="GeneratorFunction",E.isGeneratorFunction=function(t){var n="function"==typeof t&&t.constructor;return!!n&&(n===u||"GeneratorFunction"===(n.displayName||n.name))},E.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,_ in t||(t[_]="GeneratorFunction")),t.prototype=Object.create(k),t},E.awrap=function(t){return{__await:t}},f(a.prototype),a.prototype[S]=function(){return this},E.AsyncIterator=a,E.async=function(t,n,r,i){var o=new a(e(t,n,r,i));return E.isGeneratorFunction(n)?o:o.next().then(function(t){return t.done?t.value:o.next()})},f(k),k[_]="Generator",k.toString=function(){return"[object Generator]"},E.keys=function(t){var n=[];for(var r in t)n.push(r);return n.reverse(),function r(){for(;n.length;){var e=n.pop();if(e in t)return r.value=e,r.done=!1,r}return r.done=!0,r}},E.values=d,p.prototype={constructor:p,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(v),!t)for(var n in this)"t"===n.charAt(0)&&m.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=g)},stop:function(){this.done=!0;var t=this.tryEntries[0],n=t.completion;if("throw"===n.type)throw n.arg;return this.rval},dispatchException:function(t){function n(n,e){return o.type="throw",o.arg=t,r.next=n,e&&(r.method="next",r.arg=g),!!e}if(this.done)throw t;for(var r=this,e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=m.call(i,"catchLoc"),c=m.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,n){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc<=this.prev&&m.call(e,"finallyLoc")&&this.prev<e.finallyLoc){var i=e;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=n&&n<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=t,o.arg=n,i?(this.method="next",this.next=i.finallyLoc,A):this.complete(o)},complete:function(t,n){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&n&&(this.next=n),A},finish:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),v(r),A}},catch:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc===t){var e=r.completion;if("throw"===e.type){var i=e.arg;v(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:d(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=g),A}}}("object"==typeof n?n:"object"==typeof window?window:"object"==typeof self?self:this)}).call(n,function(){return this}(),r(158))}])</script><script src="/./main.0cf68a.js"></script><script>!function(){!function(e){var t=document.createElement("script");document.getElementsByTagName("body")[0].appendChild(t),t.setAttribute("src",e)}("/slider.e37972.js")}()</script>


    
<div class="tools-col" q-class="show:isShow,hide:isShow|isFalse" q-on="click:stop(e)">
  <div class="tools-nav header-menu">
    
    
      
      
      
    
      
      
      
    
      
      
      
    
    

    <ul style="width: 70%">
    
    
      
      <li style="width: 33.333333333333336%" q-on="click: openSlider(e, 'innerArchive')"><a href="javascript:void(0)" q-class="active:innerArchive">所有文章</a></li>
      
        
      
      <li style="width: 33.333333333333336%" q-on="click: openSlider(e, 'friends')"><a href="javascript:void(0)" q-class="active:friends">友链</a></li>
      
        
      
      <li style="width: 33.333333333333336%" q-on="click: openSlider(e, 'aboutme')"><a href="javascript:void(0)" q-class="active:aboutme">关于我</a></li>
      
        
    </ul>
  </div>
  <div class="tools-wrap">
    
    	<section class="tools-section tools-section-all" q-show="innerArchive">
        <div class="search-wrap">
          <input class="search-ipt" q-model="search" type="text" placeholder="find something…">
          <i class="icon-search icon" q-show="search|isEmptyStr"></i>
          <i class="icon-close icon" q-show="search|isNotEmptyStr" q-on="click:clearChose(e)"></i>
        </div>
        <div class="widget tagcloud search-tag">
          <p class="search-tag-wording">tag:</p>
          <label class="search-switch">
            <input type="checkbox" q-on="click:toggleTag(e)" q-attr="checked:showTags">
          </label>
          <ul class="article-tag-list" q-show="showTags">
             
              <li class="article-tag-list-item">
                <a href="javascript:void(0)" class="js-tag color2">good good study day day up</a>
              </li>
            
            <div class="clearfix"></div>
          </ul>
        </div>
        <ul class="search-ul">
          <p q-show="jsonFail" style="padding: 20px; font-size: 12px;">
            缺失模块。<br/>1、请确保node版本大于6.2<br/>2、在博客根目录（注意不是yilia根目录）执行以下命令：<br/> npm i hexo-generator-json-content --save<br/><br/>
            3、在根目录_config.yml里添加配置：
<pre style="font-size: 12px;" q-show="jsonFail">
  jsonContent:
    meta: false
    pages: false
    posts:
      title: true
      date: true
      path: true
      text: false
      raw: false
      content: false
      slug: false
      updated: false
      comments: false
      link: false
      permalink: false
      excerpt: false
      categories: false
      tags: true
</pre>
          </p>
          <li class="search-li" q-repeat="items" q-show="isShow">
            <a q-attr="href:path|urlformat" class="search-title"><i class="icon-quo-left icon"></i><span q-text="title"></span></a>
            <p class="search-time">
              <i class="icon-calendar icon"></i>
              <span q-text="date|dateformat"></span>
            </p>
            <p class="search-tag">
              <i class="icon-price-tags icon"></i>
              <span q-repeat="tags" q-on="click:choseTag(e, name)" q-text="name|tagformat"></span>
            </p>
          </li>
        </ul>
    	</section>
    

    
    	<section class="tools-section tools-section-friends" q-show="friends">
  		
        <ul class="search-ul">
          
            <li class="search-li">
              <a href="http://localhost:4000/" target="_blank" class="search-title"><i class="icon-quo-left icon"></i>友情链接1</a>
            </li>
          
            <li class="search-li">
              <a href="http://localhost:4000/" target="_blank" class="search-title"><i class="icon-quo-left icon"></i>友情链接2</a>
            </li>
          
            <li class="search-li">
              <a href="http://localhost:4000/" target="_blank" class="search-title"><i class="icon-quo-left icon"></i>友情链接3</a>
            </li>
          
            <li class="search-li">
              <a href="http://localhost:4000/" target="_blank" class="search-title"><i class="icon-quo-left icon"></i>友情链接4</a>
            </li>
          
            <li class="search-li">
              <a href="http://localhost:4000/" target="_blank" class="search-title"><i class="icon-quo-left icon"></i>友情链接5</a>
            </li>
          
            <li class="search-li">
              <a href="http://localhost:4000/" target="_blank" class="search-title"><i class="icon-quo-left icon"></i>友情链接6</a>
            </li>
          
        </ul>
  		
    	</section>
    

    
    	<section class="tools-section tools-section-me" q-show="aboutme">
  	  	
  	  		<div class="aboutme-wrap" id="js-aboutme">很惭愧&lt;br&gt;&lt;br&gt;只做了一点微小的工作&lt;br&gt;谢谢大家</div>
  	  	
    	</section>
    
  </div>
  
</div>
    <!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                      <div class="pswp__preloader__cut">
                        <div class="pswp__preloader__donut"></div>
                      </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div> 
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>
  </div>
</body>
</html>